#!/usr/bin/env python3
"""Ice-cream cone (ICC) diagram — genuine runtime evaluation.

GENERIC-MASS + GEN_G1 FOLD (2026-07-06; computed in this work — every
input named here ships beside this script).  (a) NEW additive --masses M2 M3 M4
(exact rational squared masses, m1^2=1): the generic connection is
specialized AT RUNTIME from the ADMITTED symbolic A' (A_symbolic.json,
sha-pinned declared-path witness loader), pure-Fraction substitution +
D2 back-rotation + eps-expansion (d = 2-2eps), with an always-on
372/372 reference identity control and an optional never-read
holdout-slice gate; covariant boundary classes derived at runtime;
reference-bound grades REFUSED fail-closed by name.  (b) GEN_G1 eps^1
fold, REV-2 2026-07-07:
ALL 19 generic grade-1 seeds are derived-or-injected at runtime -- the 11
derivable seeds DERIVED (infinity-cusp conditions, vendored boundary-derivation
stack, subprocess) and the 8 slave-master seeds INJECTED from the NEPS=4
FINAL grade-1 slave slots (g1_vendored/gen_g1_mellin/RESULT3_FINAL.json,
sha-pinned; additive file, RESULT3.json untouched).  The 19 stored AMFlow
strings DEMOTE to held-out compare gates (RAISING) and are UNREACHABLE as
transport inputs in every mode (hard guard at build_system; no --no-g1);
the eps^1 table is reference-exhausted 19/19 (dps145 check: injected
seeds agree 109.4-110.9 d = string-capped, two-precision
staircase lawful).

The ICC top master T(x) is closed by DE-transport: the validated external-
invariant connection A(d,x) (exact rational IBP data, two-route byte-identical
build) gives one coupled linear ODE for the eps-Laurent components of all
masters,

    f_{i,K}'(x) = sum_{j,k>=0} A^(k)_{ij}(x) f_{j,K-k}(x),

and the boundary eps-Laurent at x=-1 seeds the transport.  This script RUNS
that transport at runtime, mpmath-only — and (2026-07-04 back-port of the
folded row-15/16/17 scripts) it now DERIVES the boundary constants at runtime
too:

  * icc_top(cfg, x) — the evaluator: high-order local-Taylor transport of the
    full eps-graded system (eq-mass 7 masters / 21 components; generic-mass
    19 masters / 76 components) from x=-1 to any Euclidean x < -1/2, returning
    every master's eps-Laurent there.  Nothing about the target point is
    stored: change X_TARGET and the transport recomputes.
  * BOUNDARY, equal mass (rows 15/17 fold): ALL x=-1 eps-Laurent seeds
    (grades eps^-2..eps^1, including T(-1) and the weight-4 T^(1)(-1)) are
    DERIVED at runtime from the infinity-cusp analytic conditions of the
    Class-1 boundary system (BC1: no half-integer u^{3/2} branch at x=infinity,
    integer-power log ansatz; BC2: hard-bubble matching tau0 = 0; grade-1
    slots S1 = (-pi^2, -18 zeta3) Mellin residues, T1 Lambda^0 = -2 zeta2 Tri0
    two-region bracket, F50 = 0 by decay, F60 unique series).  Constants
    entering: Tri0 = 4 ln(phi)/sqrt5 (phi golden ratio) and the golden-dilog
    integrals J = Int_0^1 ln(1+a-a^2)/(1+a-a^2) da, K likewise with ln^2 —
    computed live by quadrature.  Vendored lib icc_blib.py + exact scalar ODE
    in icc-derived.json; NO AMFlow input anywhere in the chain.  The
    superseded oracle strings kept in icc-transport-data.json "eqmass" are used
    ONLY as a held-out runtime de-fit check (printed).  Internal forced gates
    verified at runtime: t11 = 2*Tri0 resonance, T1/S1 forced brackets.
  * BOUNDARY, generic mass (row-16 fold, PARTIAL): 21 of the 46 stored
    grade<=0 x=-1 seed literals are replaced by runtime computation —
    tadpole^2 masters (0,1,3,4,9) exact Gamma(eps)^2 P^-eps expansions;
    triangle masters (2,10) exact W = ln(1+sqrt2)/sqrt2 plus live quadrature;
    sunrise masters (5,11) live materialized spectral integrals
    (icc_scooplib.Scoop, gated full working precision).  DEFAULT SINCE
    2026-07-06: the remaining 25 grade<=0 literals (top T(-1) + slave/dotted
    masters) are RECOMPUTED at runtime on every default generic run (cusp
    solve + lifted transport, BDPS slaved to dps; the stored strings are a
    compare-on-load gate-cache ONLY, RAISING outside resolution — the
    recompute path is the definition; --cached restores the old fast path
    for grade<=0 ONLY).  GRADE-1 (eps^1), REV-2: all 19 generic grade-1
    seed literals are derived-or-injected at runtime in EVERY generic mode
    (GEN_G1 fold: 11 derived + 8 injected from the sha-pinned NEPS=4 FINAL
    RESULT3_FINAL.json); the stored strings are held-out compare gates only
    and are unreachable as transport inputs (hard guard at build_system) —
    the eps^1 table is reference-exhausted 19/19 (the
    formerly-disclosed eps^1 honest gap no longer exists).  eps^1 accuracy
    floors at the measured ~(g1dps-13) class, string-capped at ~110 d.
    Provenance: the vendored gen_g1_mellin RESULT3_FINAL file
    (sha-pinned).  The analytic boundary route has
    derived the top boundary condition but gates it end-to-end
    at 86.5 d — below the stored 110 d; a deeper materialized
    relative-period value is still to come.  Both routes are wired as printed
    runtime cross-checks (see the relative-period block in icc-derived.json /
    generic_runtime_seed_spec).
  * SECONDARY ROUTE (relative periods): the derived eq-mass boundary constants are
    cross-checked at runtime against the materialized relative-period
    integrals of the ICC graph — T(-1) vs a 284.8 d-gated value and
    T^(1)(-1) vs a 133.5 d-gated value (vendored in icc-derived.json), plus a
    LIVE low-dps evaluation of the same spectral representation.  Two
    independent routes to the same constants, both printed.
  * The demo evaluates both mass configurations at the held-out x=-2 and
    compares the freshly transported TOP eps^0/eps^1 against held-out AMFlow
    oracle literals, with agreement RECOMPUTED as -log10(|f-oracle|/|oracle|).
  * Cross-method check: the transported scoop (= sunrise, d=2) at x=-2 is
    compared against a live Bessel-moment quadrature
    S(x) = -4 * Int_0^inf t J0(sqrt(-x) t) prod_i K0(m_i t) dt — two
    independent runtime computations of the same number.

Literals kept, with provenance (see also icc-transport-data.json and
icc-derived.json):
  (a) ORACLE_* — independent held-out AMFlow values at x=-2, never used by the
      transport; computed in this work by separate AMFlow processes (one
      independent verification run per configuration on top of the primary
      run), stored here as the comparison strings below.  The generic eps^0
      string carries 210 d since 2026-09-06 (the goal-150 out
      P16G150WP200_xm2.json, sha256 e6f8ce6089eae39f...; the eps^1 string stays
      at 110 d: eps_order 4 carries no eps^1 order); the equal-mass pair 330 d.
  (b) the x=-1 boundary strings in icc-transport-data.json: for the equal-mass
      configuration these are now SUPERSEDED oracle references, used only as a
      held-out de-fit check of the runtime-derived seeds (printed) -- the top
      master's three (eps^0/1/2) carry 330 d since 2026-09-06 (the full midpoints
      of the AMFlow record e1hp_xm1_g320_out.json at x = -1, sha256
      d61d746286dc4de133c9be5e5c9b9af65905db29095bbb13675d4be9d1b7d584;
      the 200/199/201-d strings shipped before are byte-identical prefixes; the
      other 18 strings keep their ~200 d) and the printed de-fit line for the top
      master follows them; for the
      generic configuration 21 are superseded the same way, the remaining 25
      grade<=0 are a compare-on-load gate-cache (inputs only under --cached) --
      all 46 grade<=0 strings carry 210 d since 2026-09-06 (the full midpoints
      of the goal-150 out P16G150WP200_xm1.json at x = -1, sha256
      f96bf525099d8ea7...; the 110-d strings shipped before agree with them to
      >= 109.58 d, 31 as byte-prefixes and 15 rounded in their last digit),
      so the boundary cap (boundary_seed_digits) reads 210 where it read 110 --
      and the 19 grade-1 strings are held-out compare gates in EVERY mode
      (rev-2 hard guard; see above).  All retained constants are
      PSLQ-negative against the certified rings (icc-expression.md sec 4) —
      genuine period numbers, no closed form claimed.
  (c) the exact rational connection coefficients A^(k)_{ij}(x) and the exact
      scalar boundary ODE (integer/rational polynomial num/den lists in
      icc-transport-data.json / icc-derived.json): symbolic input data, not
      numbers at the gate point.
  (d) the materialized period values (284.8 d / 133.5 d) in icc-derived.json:
      cross-check references only, never inputs.

Archived full-precision gate record (offline oracle runs, NOT recomputed here):
eq eps^0 98.5 d / eps^1 75.0 d, generic eps^0 85.1 d / eps^1 68.6 d — those
runs were limited by the then-available boundary precision.  The previous
release of this script (stored 199 d eq boundary strings) measured
134.9/134.8 d (eq) and 107.9/108.5 d (generic) at x=-2; this back-port
(boundary DERIVED at runtime) measured 134.9/134.8 d (eq, dps-limited) and
108.1/108.6 d (generic, capped by the retained 110 d literals),
2026-07-04 — gate held/improved, now with derived constants.

Evaluation interface (kinematic point and precision are caller-chosen):
  * Library: icc_top(cfg, x, dps=D) — cfg in {"eqmass","generic"}, any real
    Euclidean x < -1/2, working precision D (local-Taylor order auto-scales
    with D).  Returns the eps-Laurent of every master at x.
  * DEFAULT RUN (2026-09-03): the quick equal-mass gate demo at dps 30 —
    the same code path as --config eqmass --dps 30, ~2 minutes on one
    processor core (measured; see Runtime below).  Every boundary constant
    is still derived at runtime and the held-out oracle comparison still
    gates the exit code (~30 d agreement at dps 30).
  * --full: the former default — BOTH mass configurations at the full
    per-config gate precision (eq-mass dps 135, generic dps 120 with the
    generic boundary recompute at BDPS 144 and the GEN_G1 eps^1 fold);
    tens of minutes on one core.  Measured 2026-09-03 (rc 0): eq-mass
    134.9/134.8 d — the archived record exactly; generic eps^0 109.9 d
    (the runtime boundary recompute has raised the archived pre-recompute
    108.1 d figure); generic eps^1 floors at its documented ~(g1dps-13)
    class at the default g1dps 60 — pass --g1-dps 145 for the
    string-capped class (measured 109.9 d).
  * CLI:  --point X --dps D [--config eqmass|generic|both]
        evaluate at a different kinematic point / precision without editing
        code (off the gate point x=-2 no stored oracle exists -- except x=-3
        on the generic configuration: --config generic --point -3 gates the
        transported top master (eps^0 and eps^1) against a second vendored
        AMFlow oracle, icc-oracle-xm3.json beside this file (sha256-pinned; the
        same family and masses at p12sq = p34sq = -3, goal 55, eps_order 6,
        110-d strings, so the printed agreement is string-capped at 110), in
        the x=-2 gate's form, rc != 0 below the bar; the scoop is
        still cross-checked live against Bessel quadrature);
          --masses M2 M3 M4
        the generic-mass covariant-seed arm (witness-bound; T(x) at these
        masses is NOT computed here -- that derivation is the sibling script
        beside this one: python3 icc-genmass-evaluate.py --masses 1,M2,M3,M4
        --point X --dps D; see the paragraph below Requires);
          --offslice X Y [--dps N] [--seed-twin] [--mutate]
        THE OFF-SLICE (X, Y) ARM (2026-09-06): the nine off-slice masters at
        eps^-2..eps^1 transported from the seed of record at (-3, -4) along
        the vendored two-variable connection to (X, Y), gated at the three
        reference points; see THE OFF-SLICE (X, Y) ARM at the end of this
        docstring;
          --double
        dps-doubling demo: rerun the eq-mass gate point at 2x dps and watch
        the live agreement digits grow with dps; the cap, min(stored oracle
        string 330 d, 2*dps + 17), is printed explicitly.  The boundary
        derivation runs ONCE at
        the deeper depth and is reused (wall: tens of minutes at default dps).
          --minkowski X [--dps N] [--detour H] [--pair] [--euclid-control]
                        [--schwarz] [--mutate] [--mutate-sign]
        the Minkowski (i0+) arm (2026-09-06): the same runtime-derived seeds and
        graded system transported along the complex detour -1 -> -1 + iH ->
        X + iH -> X (H = 2) in the upper half x-plane -- the boundary value
        x + i0 the Feynman prescription selects -- printing Re and Im of every
        component, the Schwarz control (the lower detour = the conjugate), the
        route-independence control (H + 1) and, at X = 12, the gate against the
        two vendored AMFlow physical-region records (icc-reference-minkowski.json,
        sha256-pinned; goal 40 / 60); see THE MINKOWSKI (i0+) ARM below;
          --land [--dps N] [--rho R] [--legs N] [--second-radius] [--pair] [--mutate]
        the landing arm at x = -1/2 (2026-09-08): the same runtime-derived seeds
        and graded system carried by the --minkowski arm's complex-step engine to
        x = -1/2 - rho and once around the circle |x + 1/2| = rho (rho = 1/16, N =
        1.7 dps + 20 sample points); the value AT -1/2 = the Cauchy circle mean,
        the finiteness and single-valuedness certificates printed, the 14
        components of the vendored AMFlow record at that point the gate
        (vendor_row15_landing/icc_xm1o2_g120_out.json, sha256-pinned); see THE
        LANDING ARM AT x = -1/2 AND THE BAND below;
          --band X [--dps N] [--euclid-control]
        the band -1/2 <= X < -1/4 (2026-09-08): the top master at eps^0 by TWO
        routes -- the written integral (58) in its dispersion form (mpmath-only,
        certified quadrature; the two-precision pair dps / dps + 15) printed beside
        the slice connection's complex detour around 2x + 1 = 0 (above and below,
        at dps + 15; the single-valuedness control), the two routes cross-gated; at
        X = -1/2 the integral is gated against the record instead; --euclid-control
        with X < -1/2 compares the integral with the served real-axis march and the
        stored strings; see THE LANDING ARM AT x = -1/2 AND THE BAND below;
          --onefold X [--dps N] [--config eqmass|generic] [--mutate]
        the one-fold fast path (2026-09-11): the eps^0 top master at any real X below the
        cone's threshold on the slice (x < 9 at equal mass) by the one-fold integral of
        logarithms -- the scoop bubble as a spectral propagator against the d = 2 triangle
        reduced to its three bubbles; no boundary constant, no cusp solve, no transport; the
        two-precision self-check dps / dps + 30 (60 / 90 by default), at equal mass a second
        assembly of the same integral, at X = -1 / -2 the comparison with the stored strings;
        see THE ONE-FOLD FAST PATH below;
  * DOMAIN: real x < -1/2 by the real-axis transport (--point X; the nearest
    singularity of the connection A(d,x) is x=-1/2 -- further real poles at
    -1/4, 0 and thresholds at x>0 lie outside that path; the step control
    shrinks steps toward x=-1/2, so targets there are excluded); x = -1/2
    itself by the landing arm (--land: the same seeds and graded system
    carried to -1/2 - rho and once around the circle |x + 1/2| = rho, the
    value the Cauchy circle mean with its finiteness and single-valuedness
    certificates, gated against the vendored AMFlow record at that point);
    the band -1/2 < x < -1/4 by the written integral (58) in its dispersion
    form (--band X: the second route, printed beside the connection's complex
    detour around 2x + 1 = 0; the two routes cross-gate each other, no AMFlow
    value of record inside the band); Minkowski
    x > 0 by the i0+ detour arm (--minkowski X: the same seeds and graded
    system transported above every real singular point, the boundary value
    x + i0); the threshold points {0, 1, 9, r+-} themselves refused by name;
    -1/4 <= x <= 0 not served by any transport arm; the eps^0 top master alone at
    any real x below the cone's threshold on the slice (x < 9 at equal mass; the
    stretch -1/4 <= x <= 0 included) by the one-fold fast path (--onefold X).
  * ACCURACY CAP: equal mass — the boundary seeds are DERIVED at runtime at
    dps+25 working precision (measured derivation loss <= ~8 d), so accuracy
    tracks --dps itself; raise --dps and every digit is recomputed, capped
    only by the stored ORACLE strings (330 d) when measuring agreement.
    Generic mass — DEFAULT SINCE 2026-07-06: ALL 25 retained grade<=0
    generic literals are RECOMPUTED at runtime on every generic run (layer
    closed forms + cusp solve with the DERIVED slot ring, data-driven from
    icc_slots_result.json, + lifted-order transport, order ~ 1.2*BDPS); the
    stored strings are a compare-on-load gate-cache that RAISES on any
    entry outside its resolution (axis3 wave 2026-07-05; was a warning).
    BDPS slaves to the generic working precision, BDPS = max(110,
    ceil(1.2*dps)); an explicit --boundary-recompute BDPS overrides;
    --cached restores the old fast path for grade<=0 ONLY (those stored
    strings supply the transport; held-out oracle gates still RAISE below
    bar).  COST (measured, honesty about walls): the recompute adds ~360 s
    at BDPS 110 on an otherwise idle core (390.3 s total measured for the
    same code path at dps 60); the generic dps 120 -> BDPS 144
    costs more (measured 30->60->110 scaling ~(bdps ratio)^2.2), and heavy
    machine load has measured up to ~5x.  The 19 grade-1 (eps^1) generic
    seeds are derived-or-injected at runtime in EVERY generic mode (GEN_G1
    fold, rev-2: reference-exhausted 19/19; measured G1 wall ~390-690 s at
    g1dps 60, 1568.8 s at 145); their strings are held-out compare
    gates only, unreachable as inputs (hard guard).
    The
    scooplib S/S14 mdeg-agreement self-check is likewise a RAISING gate
    (tol 10^-(dps+10), mdeg escalates to +6 then fails closed; measured
    agreement EXACT at dps 30-180, healthy runs never escalate).  ALL
    remaining quadratures (icc_blib J/K2c seed integrals + period_T_eps0,
    the I1 triangle integral here, the vendored row16_solve.py J12) are
    likewise CERTIFIED fail-closed since the axis3 wave 2026-07-05: the
    engine's own error=True estimate must beat a 10^-(dps+10)-keyed tol or
    maxdegree doubles, RuntimeError at the cap.
    (16,0)/(18,0) FIXED
    2026-07-05: the former OPEN u^(1/2) "defect" was a solver bug (E_F
    forward reference, two-pass fix; fifth dof = 0).  Production record:
    gate PASS 25/25 at the full stored-string bar, min 109.6 d
    (icc_slot5/RESULT.md, e2e_corr140fix / e2e_corr160fix2).
    D2 fold-time map for masters 6-8: see generic_boundary_recompute.__doc__.

Requires only Python 3 + mpmath (sympy needed for the generic
boundary recompute; the default and --config eqmass run without it).
T(x) at masses OTHER than the reference configuration (1,2,3,5) is not
computed by this script: the derivation at any rational masses (the
cusp-solve grades included) is the sibling icc-genmass-evaluate.py beside
it (python3 icc-genmass-evaluate.py --masses 1,M2,M3,M4 --point X --dps D;
its --help lists the tiers and walls); the --masses M2 M3 M4 arm here
derives the covariant seeds only and refuses the rest by name.
The two scripts check each other (2026-09-06): icc-genmass-evaluate.py
pins this file's sha256 in its PINS table and refuses a mismatch (its
exit code 3); this file, before serving --masses, reads that recorded pin
and compares it with its own bytes -- no sha of the sibling is recorded
here (a pin in each direction would be circular: each file's bytes would
depend on the other's) -- and refuses by name with exit code 3 when the
pair is out of step (one script changed without the other), exit code 4
when the sibling file is missing beside it (SIBLING_PIN, check_sibling_pair).
Runtime (measured, single core): the DEFAULT quick equal-mass run at dps 30
takes ~2 minutes of CPU (measured 2026-09-03, two runs: 90-101 s CPU on one
core; walls 129-235 s under heavy shared-machine load; the wall is printed
at the end of every run).
--config eqmass (the row gate: the DEFAULT precision dps 135) prints
134.9 / 134.8 d (eps^0 / eps^1): 6:16.97 wall (376.97 s,
81892 kB max RSS) in a 200 % CPU scope at host load ~190 on 96
cores (the 2026-09-06 record run).  Documented deeper tiers on the equal-mass
arm (the stored oracle strings carry 330 d, so the printed agreement tracks
--dps up to the cap min(330, dps + 17); dps 135 stays the default, the row
gate is the default-precision run):
  --config eqmass --dps 200 -> 200.1 / 199.4 d; 12:09.43 wall (729.43 s,
    98724 kB) in the same scope at host load ~190;
  --config eqmass --dps 260 -> 260.4 / 260.8 d; 19:23.28 wall (1163.28 s,
    128460 kB) in the same scope at host load ~190.
This release's own fixture runs of the same three tiers (one process each,
nice 10, no CPU scope, 3 concurrent on a shared host at load ~131):
dps 135 428 s (70192 kB), dps 200 809 s (98852 kB), dps 260 1274 s
(123416 kB), the same digit counts.
--config generic (the row-16 gate at the DEFAULT precision dps 120: the BDPS 144
boundary recompute + the GEN_G1 fold at g1dps 60) prints 118.2 / 47.2 d
(eps^0 / eps^1 at x=-2 vs the 210-d / 110-d oracle strings; eps^1 at its
documented ~(g1dps-13) class) and the recomputed T(-1) vs its 210-d x=-1
string 133.6 d: 1697.96 s wall (162404 kB max RSS) in a 200 % CPU scope
at host load ~141.74 (2026-09-06; the bytes shipped before, with 110-d
strings, printed 109.9 / 47.2 d and T(-1) 109.802 d,
string-capped, 1692.77 s in the same scope at host load ~116.69).
--config generic --point -3 -> 110.3 / 47.4 d (eps^0 / eps^1 vs the
vendored 110-d strings, string-capped at 110): 1749.30 s wall in the same
scope at host load ~141.74.
--full: the both-config gate run at full precision was
measured at ~8.5 minutes (503 s; dominated by the eq-mass boundary
derivation) PLUS the generic boundary recompute (~360 s at BDPS 110 on an
otherwise idle core; the generic dps 120 -> BDPS 144 setting costs more,
~(bdps ratio)^2.2 measured scaling) PLUS the GEN_G1 eps^1 fold (~390-690 s
at g1dps 60) — tens of minutes in total, and heavy machine load has
measured up to ~5x.

THE OFF-SLICE (X, Y) ARM (2026-09-06): --offslice X Y [--dps N] [--seed-twin] [--mutate] [--workdir DIR]
  Off the symmetric slice the cone has NINE masters (the two sunrises split and sector 14 enters with two); their
  two-variable connection (A_x, A_y)(eps, x, y) at w = p56^2 = -1, m^2 = 1 -- exact rational 9 x 9 matrices in
  (d, x, y), d = 2 - 2 eps, from the Kira reduction of the derivative seeds at symbolic (p12^2, p34^2), integrable
  (dA = A ^ A vanishes identically in Q(d, x, y): the verdict recorded in xy/A_point.json) and restricting exactly to
  the one-variable connections of the lines p12^2 = -3 and -2 that icc-offslice-evaluate.py serves -- is vendored
  beside this file as vendor_rows1517_offslice/xy/A_xy_eps_monomial.json (36 + 36 nonzero entries; the export
  record xy/A_point.json beside it carries the masters, the denominator census and the integrability verdict).  This
  arm transports the nine masters' eps^-2..eps^1 coefficients (27 state components) from the seed of record at
  (-3, -4) -- the served AMFlow value vendor_rows1517_offslice/line_m3/seed_e5.json (goal 40, eps_order 5), reused by
  pin -- to a point (X, Y) of the Euclidean region (X = p12^2, Y = p34^2 exact rationals; X, Y < 0; X != Y) along
  straight segments by the engine xy/transport_xy.py (the y-transport numerics of record verbatim: local Taylor steps
  of order ceil(1.7 dps) + 20, each step = 1/4 of the distance to the nearest singular point, a trailing-window tail
  bound per step; the two-variable connection restricted to each segment, its eps-Taylor coefficients from the exact
  monomials), and prints them at dps + 5 significant digits with the step / tail-bound / imaginary-part record of
  every segment.  --dps 60 is the record's gate precision (the default here), 45 its other one.
  THE ROUTE: (-3, -4) -> (-3, Y) along the line p12^2 = -3, then (-3, Y) -> (X, Y) at fixed p34^2 = Y; the other
  order, (-3, -4) -> (X, -4) -> (X, Y), and the direct chord are the alternatives.  A segment whose chord crosses
  the apparent diagonal x = y (the nine-master basis degenerates there; the physical solution is analytic: the
  Frobenius certificate of the served --land tier's record) is replaced by the complex detour P -> W -> Q with W
  the chord's midpoint displaced by (-i/4, +i/4) off x = y (the record's detour; on either side the same values).
  Every real segment is checked EXACTLY, before any computation, for a zero of a census factor (each factor
  restricted to the segment is a rational quadratic in the segment parameter; a sign change or an inside vertex
  with a non-negative discriminant is a zero): the first of the three candidate routes whose real segments are free
  of census zeros is taken, one without a diagonal crossing preferred; corners on the diagonal are never used.
  When all three candidates meet a singular curve the point is REFUSED by name (exit 2): this arm does not steer
  around the census curves ((-2, -9) is such a point: the connection is singular on x = -3 at p34^2 = -3 - sqrt 5).
  The engine still guards its own path (a root within 1e-6 of a segment stops it, exit 5).
  REFUSED by name (exit 2), before any computation: the slice X = Y (this arm gives no value ON the slice -- the
  default tiers do); a point outside the Euclidean region (X >= 0 or Y >= 0); a zero of a denominator factor of the
  connection at d = 2, evaluated exactly at (X, Y) (the census of xy/A_point.json: x, x - 1, x - 9, x - y, y, y - 1,
  y - 9 and the five quadrics x**2 - 2*x*y + 2*x + y**2 + 1; x**2 - 2*x*y + 2*x + y**2 + 2*y + 1; x**2 - 2*x*y + y**2 + 2*y + 1; x**2 - 3*x*y + 5*x + y**2 + 5*y - 5; x**2 - 3*x*y + x + y**2 + y - 1); a point no census-free straight-segment route reaches (above).
  THE PINS: every file the arm reads is sha256-pinned in OFFSLICE_PINS (14 files: the xy/ directory, the served
  seed line_m3/seed_e5.json and the served parser amf_result.py): a byte changed refuses by name (exit 3), a file
  missing (exit 4), before any computation.  The pins are read on --offslice only (no other tier reads these files;
  the bundle's MANIFEST.sha256 pins every file for every tier).
  THE GATE at the three reference points (the vendored AMFlow values of record, eps_order 5, eps^-2..eps^1, never
  transport inputs): PA = (-3, -15/4) on the p12^2 = -3 line (goal 40 and 60: xy/PAe5_g40.json, xy/PAe5_g60.json),
  PB = (-5/2, -15/4) off both lines (goal 40 and 60), PM = (-15/4, -5/2), the mirror of PB across the diagonal (goal
  40 only).  Every (master, order) pair (27) is compared as log10(max(|a|,|b|) / |a - b|) on the real parts, capped
  by the shorter string; the worst with its member, the per-order floors with members and the count of identical
  strings are printed; bar 30 (the two-precision bar) on every pair, else FAIL by name (exit 1).  The record's
  floors are printed beside the run's own (the run's own is the figure): PA 48 digits (measured 48.12 d, master
  [1, 1, 1, 1, -2, 0, 0] at eps^1 vs goal 40; vs the goal-60 twin 47, measured 47.78 d), PB 47 (measured
  47.94 d, [1, 1, 1, 1, -2, 0, 0] at eps^1; vs goal 60 47, measured 47.94 d), PM 47 (measured 47.86 d,
  [1, -2, 1, 1, 0, 0, 0] at eps^1); the eps^1 rows 48 / 47 / 47, the eps^0 rows 55 / 55 / 55; the transports at dps 45 and
  60 agree to 49 / 49 / 49; the goal-40 / goal-60 AMFlow pairs at PA / PB to 47 / 48.  Every count is a floor of a
  two-string agreement: the goal-40 eps_order-5 seed caps the transported values (the eps^1 floor ~48 is the seed's
  own depth), never a precision claim on the AMFlow records.
  --seed-twin repeats the transport from the goal-60 seed (xy/S34e5_g60.json, the same point) and prints the twin
  agreement over the 27 components (bar 30; the record's 47 / 47 / 47 at PA / PB / PM, measured 47.78 / 47.94 / 47.97 d); at
  PA and PB the goal-60 transport is gated against the goal-60 AMFlow value too.  --mutate (at a reference point):
  the eps^0 string of the top master [1, 1, 1, 1, 0, 0, 0] in the goal-40 reference is perturbed at its 20th
  significant digit in a copy the gate reads (the file and its pin untouched): the gate MUST fail by name (exit 1;
  exit 6 if not caught).  The engine and the gate run as subprocesses (xy/transport_xy.py, xy/compare_xy.py) and
  write their receipts under --workdir (default: a fresh temporary directory, its name printed); no AMFlow call at
  run time.  The arm needs sympy (the census roots on each segment), as the generic tiers do.
  USAGE
    python3 icc-evaluate.py --offslice -3 -15/4               # PA at dps 60: the transport + the gate vs goal 40 and 60
    python3 icc-evaluate.py --offslice -5/2 -15/4 --dps 45    # PB at the record's other precision
    python3 icc-evaluate.py --offslice -15/4 -5/2 --seed-twin # PM across the diagonal (the detour) + the goal-60 seed twin
    python3 icc-evaluate.py --offslice -7/2 -9/2              # a point with no reference: the nine masters printed, no gate
    python3 icc-evaluate.py --offslice -3 -15/4 --mutate      # the control: the gate FAILS by name (exit 1)
    python3 icc-evaluate.py --offslice -3 -3                  # REFUSED (exit 2): the slice
  EXIT CODES (this arm)  0 the transport done and every gate met | 1 a gate pair below the bar (named; the expected
    outcome of --mutate) | 2 REFUSED by name (the slice, a census zero, outside the Euclidean region, no census-free
    route; usage) | 3 a
    pinned file's sha256 mismatch (named) | 4 a pinned file MISSING | 5 the engine or the gate did not finish (a
    singular point on the path; else its exit code and last line printed) | 6 the --mutate control NOT caught.
  WALLS (measured on the delivered bytes, one process in a 200 % CPU scope at nice 10 on a shared 96-core host at
    loadavg ~90-100 -- contended figures, never a projection; a quiet core is faster): PA dps 60 17.33 s
    (2 steps), dps 45 13.00 s; PB dps 60 39.78 s, dps 45 29.22 s; PM dps 60 308.57 s (the
    detour), dps 45 221.86 s; PM dps 60 with --seed-twin 640.46 s.
  WHAT THIS ARM DOES NOT DO (the record's own lines): no value ON the slice itself (X = Y is refused; the default
    tiers cover the slice); no AMFlow-free off-slice value; nothing beyond eps^1.  Not established:
    - a transport seeded ON the slice: the seed of this arm is the off-slice AMFlow value of record at (-3, -4) (and its goal-60 twin), the same seed the served --land tier's record starts from; a transport that STARTS on the slice y = x needs the physical solution's exponent-1 datum at the apparent point (the Frobenius certificate of that record: indicials -1 x2, 0 x6, +1 x1 -- a solution vanishing at y = x), which no AMFlow-free object on file carries; no AMFlow-free off-slice value is claimed
    - the four masters without a mirror image in the nine-master basis ([1,1,1,0,0,0,0], [1,1,1,1,0,0,0], [1,1,1,1,0,-1,0], [1,1,1,1,-2,0,0]): the mirror observation covers the tadpole squared and the two pairs only; PM is gated by its own AMFlow leg
    - any digit beyond the seed's own depth: the goal-40 eps_order-5 seed caps the transported values (the gate floors are floors of two-string agreements, never a precision claim on the AMFlow records)
    - PM at goal 60: not run (the mirror point carries one goal-40 leg; the two-precision pair at PM is the dps 45/60 transport pair)
    - the ε² and deeper orders: eps_order 5 / target_eps_power 1 carries eps^-4..eps^1; nothing beyond eps^1 is transported or gated

THE MINKOWSKI (i0+) ARM (2026-09-06): --minkowski X [--dps N] [--detour H] [--pair] [--euclid-control] [--schwarz]
                                     [--mutate] [--mutate-sign]
  THE PRESCRIPTION.  The AMFlow family of record writes the propagators as l^2 - m^2 (mostly-minus metric) and the
  values are 1/prod(D + i0): on the slice p12^2 = p34^2 = x, p56^2 = -1, m^2 = 1 every timelike invariant carries
  s -> s + i0, i.e. x -> x + i0 -- the physical value in the Minkowski region x > 0 is the boundary value of the
  analytic continuation from the UPPER half x-plane.  The x - i0 boundary value (the lower half-plane) is its
  complex conjugate (Schwarz reflection: real seeds at x = -1, real-rational connection), and the two differ by the
  discontinuity 2i Im f(x + i0) -- the monodromy of the connection around the thresholds crossed.
  THE ROUTE.  The arm derives the served equal-mass seeds at runtime (eqmass_derived_seeds at dps + 25, the code
  path of every equal-mass tier), builds the served graded 21-component system (build_system: 7 masters x
  eps^-2..eps^1) and transports it from x = -1 along -1 -> -1 + iH -> X + iH -> X (straight legs, H = 2 by
  default; --detour H), above every real singular point of the connection.  The step is a NEW unit beside the
  served real-axis taylor_step (which is untouched): minkowski_taylor_coeffs runs the same recursion
  (n+1) a_{n+1} = sum_k M_k a_{n-k} at the complex expansion point in mpc arithmetic, with the connection's Taylor
  coefficients from the served rat_taylor (called), and minkowski_march applies the record engine's step
  control: |h| = hfrac x the distance to the nearest declared singular point in the complex plane, hfrac from 1/2
  and halved while the certified geometric tail bound of the series (the last two above-floor terms, ratio clamped
  at 3/4) exceeds 10^-(dps+8) relative to the state, regrown x2 after each accepted step; the final step exact;
  working precision dps + 33, Taylor order max(60, 0.75 dps + 25).  No leg touches the real axis between -1 and X.
  THE SINGULAR POINTS of the 7-master system (the denominator factors x - 9, x - 1, 4x + 1, 2x + 1,
  x^2 - 10x + 5 and x of the served 'eqmass' coef block; the residue census of the record):
      -1/2  = -1/2            pole order of A^(k), k = 0..3: 1/2/3/4;  local exponents at eps^0: 0 (x6), 1 (x1)
      -1/4  = -1/4            pole order of A^(k), k = 0..3: 1/1/0/0;  local exponents at eps^0: 0 (x5), 1/2 (x2)
      0     = 0               pole order of A^(k), k = 0..3: 1/1/1/1;  local exponents at eps^0: 0 (x6), -2 (x1)
      1     = 1               pole order of A^(k), k = 0..3: 1/1/1/1;  local exponents at eps^0: 0 (x6), -1 (x1)
      9     = 9               pole order of A^(k), k = 0..3: 1/1/1/1;  local exponents at eps^0: 0 (x7)
      r-    = 5 - 2*sqrt(5)   pole order of A^(k), k = 0..3: 1/1/1/1;  local exponents at eps^0: 0 (x7)
      r+    = 2*sqrt(5) + 5   pole order of A^(k), k = 0..3: 1/1/1/1;  local exponents at eps^0: 0 (x7)
    Every cusp and r+- is a simple pole at every grade (regular-singular); at -1/2 the pole order is k + 1 in
    A^(k) (not regular-singular in the served gauge); at -1/4 the poles are simple at k = 0, 1 and absent at
    k = 2, 3.  The detour passes above all of them and never lands on one: X in {0, 1, 9} or within 10^-6 of r+-
    is REFUSED by name (exit 2); so is X <= 0 (the Euclidean axis x < -1/2 is the served --point tier; -1/2 <= x
    <= 0 is not served) except the control form --minkowski -2 --euclid-control below.
  The gate, the transport pair and the Euclidean comparisons read the values AS PRINTED (rounded to dps: the digits
  the script certifies are the digits it prints -- the record's convention, its prediction strings at dps); the
  Schwarz and route controls read the full working precision dps + 33 (they measure the engine, and read the
  roundoff class of the march: ~70 d at dps 60 here vs the record's 92 d at its acb working precision 120).
  THE CONTROLS (every one RAISING, exit 1 by name below its bar).  (1) Schwarz: the lower detour (H -> -H)
  must be the complex conjugate of the upper, member by member (identical expected on all 21; bar dps - 5;
  --schwarz prints the per-component table).  (2) Route independence: the second upper route at H + 1 vs the
  route of record (bar dps - 8; the record read 92.1 d at dps 60, 122.3 d at dps 90).
  (3) Monodromy record: which components resolved an imaginary part (|Im| / max(|value|, 1) > 10^-(dps-10)); the
  record at x = 12: 10 of 21 nontrivial ['(2,0)', '(2,1)', '(3,0)', '(3,1)', '(4,0)', '(4,1)', '(5,0)', '(5,1)', '(6,0)', '(6,1)'], trivial on the
  bubble, the triangle and the eps^-1 / eps^-2 layers.  (4) The transport pair (--pair): the same upper detour at
  dps + 30 (seeds re-derived at dps + 55), floor over the 21 components (bar dps - 8; the record: dps 60 vs 90
  59.4 d at (0,-1)).  (5) The Euclidean limit (--minkowski -2 --euclid-control): the detour form to x = -2
  vs the served real-axis march (icc_top, the served step rule at working dps; bar dps - 12: the direct march
  runs at dps itself) and vs the stored 330-d AMFlow oracle strings at x = -2 (bar dps - 8); |Im| of the detour
  values at a real Euclidean point printed.  (The record's engine ran both members at dps + 33 and read
  70.1 d / 62.1 d at dps 60; the served direct march is the comparison here.)
  THE GATE AT X = 12 (above every threshold: r+ = 9.472...).  icc-reference-minkowski.json (sha256-pinned in-code,
  MINKOWSKI_REFERENCE; a byte changed -> exit 3, the file missing -> exit 4, by name, before any computation)
  carries the two AMFlow physical-region records at p12^2 = p34^2 = 12, p56^2 = -1, m^2 = 1 -- goal 40 and
  goal 60, eps_order 4 (eps^-2..eps^0), 7 masters x their orders = 14 complex components each, midpoints and
  radii verbatim from the outs named by sha256, keyed by the served master index -- and the record's
  prediction-first receipt (the transported x + i0 values were filed before either AMFlow job started).  The gate
  compares every component's complex value, Re and Im (each relative to |record|) with the record ('identical (N)'
  below the record's printed resolution 10^-N); bar = min(dps, 57) - 10 where 57 = floor(the AMFlow pair floor,
  goal 40 vs goal 60: 57.90 d at (6,0)) is the count the two records certify for each other; FAIL by name, exit 1.
  The record's floors at dps 60: vs goal 40 complex 57.9 d at (6,0), Im 59.0 d at (4,0); vs goal 60
  complex 59.4 d at (0,-1), Im 60.2 d at (2,0); T(12 + i0) eps^0 (the top master) at dps 90:
  Re -1.677615054709485895592094736432934561914641... Im 0.2951715917675616282458722233634095849214705....
  The eps^1 layer (the 7 components (i,1)) is transported on the same detour but has NO AMFlow record at this
  point (eps_order 4 stops at eps^0): it is certified by the transport pair only, not gated.  The summary line
  '<N> digits incl. Im (the AMFlow pair; the transport pair <M>)' prints N = floor(the worst gate floor over both
  records, Re / Im / complex) and M = floor(the transport pair floor) from the run's own figures; the tier the
  line is named for is --minkowski 12 --dps 60 --pair (M reads 'not run' without --pair).
  --mutate is the NEGATIVE CONTROL of the record (the one --mutate option serves both this arm and --offslice:
  each arm reads it in its own dispatch): the goal-40 record's (4,0) Re midpoint is perturbed in memory
  by a relative 1e-25 (the record's control form; the file and its pin untouched) -- the gate MUST fail by name
  at (4,0) (exit 1; exit 6 if not caught).  --mutate-sign is the NEGATIVE CONTROL of the prescription: the LOWER
  detour (x - i0) is gated as if it were the physical value -- Re agrees, Im flips sign, so the gate MUST fail
  by name on every component with a resolved imaginary part (exit 1; exit 6 if not caught).  The two controls
  bite only at dps >= 45 (bar = min(dps, 57) - 10 must exceed the 25 digits the planted digit leaves).
  WHAT THIS ARM DOES NOT ESTABLISH (the record's own list; two phrases re-worded for this file's register, the
  substance verbatim):
    - any Minkowski point other than x = 12 against an oracle (the detour reaches any x > 0 not on {0,1,9,r+-}; one point gated)
    - the equal-mass eps^1 layer (i,1) at x + i0 against any AMFlow record (the records stop at eps^0 for this eps_order-4 run; pair-only, two working precisions)
    - the values AT the threshold points x in {0, 1, 9, r+-} (not landed on; the local exponents at eps^0 are listed from the residues, the eps-dependent exponents of the full connection are not solved)
    - a regular-singular form at -1/2 (item48: pole order k+1 in A^(k)) -- the detour passes above it and never lands there
    - the generic-mass cone's Minkowski region (the 19-master generic system is not transported here)
    - the sunrise family's physical region (a separate order; no work object exists)
    - a second, dispersion-side route into the Minkowski region (dispersify on the written integral (58)): the served text states that representation for Euclidean x < -1/4 only; its +i0 continuation is a separate order -- the Minkowski gate here is transport vs AMFlow only
  USAGE:
    python3 icc-evaluate.py --minkowski 12                       # dps 60: the gate against both records
    python3 icc-evaluate.py --minkowski 12 --dps 60 --pair       # + the dps 90 twin: the summary line's tier
    python3 icc-evaluate.py --minkowski 25/2 --dps 40            # any x > 0 off the thresholds: values + controls, no oracle
    python3 icc-evaluate.py --minkowski -2 --euclid-control      # the Euclidean-limit control at x = -2
    python3 icc-evaluate.py --minkowski 12 --mutate              # the control: the gate FAILS by name (exit 1)
    python3 icc-evaluate.py --minkowski 12 --mutate-sign         # the control: the x - i0 sheet FAILS on Im (exit 1)
  EXIT CODES: 0 PASS | 1 a gate or control below its bar (FAIL by name; also the expected outcome of --mutate and
    --mutate-sign) | 2 REFUSED by name (X <= 0 without --euclid-control, a threshold point, a non-rational X, the
    controls off the gate point, --euclid-control with X >= -1/2) | 3 the reference's pin mismatch | 4 the reference
    missing | 6 a negative control NOT caught.
  WALLS (measured on the first cut of this arm, whose Minkowski units are identical to this file's under the masked
    AST; one process at nice 10 in a 200 % CPU scope on a shared 96-core host; the loadavg at launch in the
    capture): --minkowski 12 --dps 60 550 s (seeds 94 s,
    the three routes 456 s); --minkowski 12 --dps 60 --pair 1082 s;
    --minkowski 12 --dps 30 205 s; --minkowski -2 --euclid-control --dps 60 333 s;
    the two controls at dps 60 552 s / 549 s.  The real-axis tiers are untouched
    (the default quick run re-measured at 115 s on these bytes).

THE LANDING ARM AT x = -1/2 AND THE BAND -1/2 <= x < -1/4 (2026-09-08): --land [--dps N] [--rho R] [--legs N]
                                     [--second-radius] [--pair] [--mutate];  --band X [--dps N] [--euclid-control] [--mutate]
  THE POINT.  x = -1/2 is the nearest singular point of the slice connection: A^(k)(x) carries the factor (2x + 1)^(k+1),
  pole order k + 1 at grade k = 0..3 (the residue census of MINKOWSKI_SINGULAR) -- NOT regular-singular in the served
  eps-graded gauge, so no Frobenius (indicial-exponent) landing is defined on it, and the record's attempt at that form
  was refused by its tool (REFUSED BY THE TOOL) -- yet the physical solution is analytic and single-valued there
  (the certificates below).  The served real-axis step control shrinks toward -1/2 and refuses it (icc_top); the
  Minkowski detour passes above it and never lands.
  THE LANDING (--land).  The served seeds and graded 21-component system (eqmass_derived_seeds at dps + 25, build_system:
  the code path of every equal-mass tier) are carried by the --minkowski arm's complex-step engine (minkowski_march:
  minkowski_taylor_coeffs = the served taylor_step's recursion at a complex expansion point with the served rat_taylor,
  the certified geometric tail bound per step at 10^-(dps+8) relative to the state; working precision dps + 33, Taylor
  order max(60, 0.75 dps + 25)) along the real axis from x = -1 to x = -1/2 - rho (rho = 1/16 by default; --rho R with
  0 < R <= 1/8), then once around the circle |x + 1/2| = rho through N equally spaced sample points x_j = -1/2 + rho
  e^(i pi (1 + 2 j / N)), j = 0..N, counter-clockwise from -1/2 - rho (N = 1.7 dps + 20 by default, the record's count;
  --legs N >= 16).  Around the circle ONE Taylor expansion serves every following sample point its certified tail bound
  reaches (land_circle: the same bound at each sample point's own step, the expansion moving on from the last certified
  point), so the expansions are fewer than N.  The value AT x = -1/2 is the Cauchy circle mean, the u^0 coefficient
  c_0 = (1/N) sum_j y(x_j) with u = x + 1/2: for a solution analytic within |u| < 1/4 (the next singular point, -1/4)
  the mean errs by the aliasing terms c_N rho^N + ..., i.e. by (4 rho)^N = 4^-N at rho = 1/16 -- below 10^-(0.6 N).
  THE CERTIFICATES, every one RAISING (exit 1 below its bar): the finiteness certificate |c_-1| = |(1/N) sum y u| and
  |c_-2| = |(1/N) sum y u^2| (the coefficients a solution with a pole at -1/2 would carry: both must be below
  10^-(dps-10) relative to max(|c_0|, 1)); |Im c_0| below the same bar (a real point); the closed-circuit return (the
  state after the full circle vs the state it started from, below the same bar: single-valued, no monodromy around
  2x + 1 = 0); the served-tier control (the state at -1/2 - rho by the complex-step engine vs the served real-axis march,
  icc_top at working dps; bar dps - 12); --second-radius repeats the circle at rho/2 and prints the two-radius
  agreement of the means (bar dps - 8).  The derivative dT/dx at -1/2 is c_1 = (1/N) sum y / u (printed for the top
  master at eps^0).  THE GATE: vendor_row15_landing/icc_xm1o2_g120_out.json (sha256-pinned in-code, LANDING_REFERENCE;
  a byte changed -> exit 3, the file missing -> exit 4, by name, before any computation) is the AMFlow record of the
  equal-mass 7-master system at p12sq = p34sq = -1/2, p56sq = -1, m^2 = 1 (goal 120, eps_order 4, d0 = 2), the out file
  itself VERBATIM: 7 masters x eps^-2..eps^0 by lead order = 14 real components as [midpoint +/- radius], every midpoint
  130 significant digits, the radii at most 4.79e-130 (the largest, at component (2,0)), imaginary parts 0 (the input file naming the point is not vendored:
  it carries a working-directory string; its sha256 322646cc9fde0852...); the record was filed before any transport
  reached the point.  The 14 components are compared as printed at dps ('identical (130)' below the record's printed
  resolution), bar = min(dps, 130) - 10; FAIL by name, exit 1.  The eps^1 layer (the 7 components (i,1)) is landed with
  the same certificates but has no record (eps_order 4 stops at eps^0): pair-only.  --pair repeats the landing at
  dps + 30 (seeds re-derived at dps + 55, N = 1.7 (dps + 30) + 20) and prints the pair floor over the 21 components as
  printed (bar dps - 8; the summary line's second figure).  --mutate is the NEGATIVE CONTROL: the record's (4,0)
  midpoint (the top master at eps^0) perturbed in memory by a relative 1e-25 (the file and its pin untouched) -- the gate
  MUST fail by name at (4,0) (exit 1; exit 6 if not caught); it bites at dps >= 40.
  THE RECORD (the landing of record by its own engine, the same construction at rho = 1/16, N = 1.7 dps + 20): at dps
  140 the gate floor 129.5 d at (1,0) (14 pass / 0 fail / 7 no record; identical (130) on
  10), |c_-1| <= 5.1811e-141, |c_-2| <= 1.1128e-141, the closed-circuit return 3.1879e-139, |Im c_0| <=
  1.8592e-138 (258 legs); the transport pair dps 110 vs 140: 108.7 d at (3,1); at dps 110 the floor
  109.5 d at (3,0); at dps 60 58.9 d at (3,-1) and the two-radius agreement (1/16 vs 1/32) 57.66 d; the planted-digit
  control at dps 140 ((4,0), digit 60) read 58.8 d -> FAIL.  T(-1/2) at eps^0 (the top master, dps 140):
  0.63729940293564870663073724181819738020600371009363637575066960...
  THE BAND (--band X), -1/2 <= X < -1/4 an exact rational.  ROUTE 2 is the written integral (58) of the accompanying text
  (its label eq:icc-materialized; the number as of the 2026-09-06 build) for the top master at eps^0 on the slice
  w = p56^2 = -1 at equal masses,  T0(x) = int_0^1 da/(a(1-a)) int_Delta d^2alpha F^-2  with  F = alpha1 + alpha2 +
  alpha3 s(a) + alpha1 alpha2 - x alpha3 (alpha1 + alpha2),  s(a) = 1/(a(1-a)), in its dispersion form  T0(x) =
  int_4^inf ds rho(s) K(s; x)  with rho(s) = 2 / sqrt(s (s - 4)) (the two-dimensional equal-mass bubble spectral density)
  and K(s; x) = int_Delta F^-2 the effective triangle: its inner alpha-fold is elementary (rational + one logarithm,
  written in a large-s-stable form, band_kernel) and its outer fold one tanh-sinh; the threshold turn-on is removed by
  s = 4 + u^2 (rho ds = 4 du / sqrt(4 + u^2)), so the outer integral int_0^inf 4 / sqrt(4 + u^2) K(4 + u^2; x) du is a
  smooth tanh-sinh on [0, inf) certified fail-closed by the served quad_certified (the engine's estimate below
  10^-(dps+2), maxdegree doubling, RuntimeError at the cap; working precision dps + 10).  Printed: the integral at dps
  (default 45) and at dps + 15 -- the two-precision pair, its floor the count the integral certifies (capped at
  dps + 5) -- and the a-form at dps 20 (T0 = 2 int_0^(1/2) da/(a(1-a)) K(1/(a(1-a)); x), the direct fold, an independent
  assembly of the same integral; bar 15, RAISING).  ROUTE 1, in the open band -1/2 < X < -1/4: the served seeds and
  graded system carried by the --minkowski arm's engine along -1 -> -1 + iH -> X + iH -> X with H = 3/20 (above the
  letter 2x + 1 = 0) and along the mirror route below it (minkowski_route, the two detours), at dps + 15: the
  single-valuedness control (the upper vs the lower detour, bar (dps + 15) - 8, RAISING; no monodromy around 2x + 1 = 0),
  |Im| of the values at the real point, the 21 components printed, and THE CROSS-GATE: the detoured top master at eps^0
  vs the integral, bar = min(the integral's pair floor, dps) - 8, RAISING.  At X = -1/2 the integral is gated against the
  record's (4,0) midpoint instead (the pin as for --land; the transport value AT -1/2 is the --land arm; --mutate
  perturbs that midpoint, the comparison MUST fail).  NOT ESTABLISHED: no AMFlow value of record exists inside the band;
  the two routes cross-gate each other, the integral's own pair capping the comparison; the eps^1 layer in the band is
  transported (printed) but has no second route.  --euclid-control (X < -1/2): the control form -- the integral vs the
  served real-axis march (icc_top at dps) and vs the stored strings where they exist (x = -1: the top master's x = -1
  string, 330 d; x = -2: the stored AMFlow oracle string, 330 d), bar min(pair, dps) - 8.  Not served: X >= -1/4 (the
  connection's second real singular point -1/4 has local exponents 0 and 1/2 at eps^0; the written integral is stated
  for x < -1/4), refused by name (exit 2), as is X < -1/2 without --euclid-control (the served --point tier).
  THE RECORD in the band (the integral by the record's dispersion engine at dps 45, the detour by the record's transport engine
  at dps 60): x = -1/2: the integral vs the record's (4,0) 50.2 d (pair 43.7 d); x = -9/20: integral vs detour
  50.4 d (pair 43.7 d; the upper vs the lower detour identical (60) for 21 of 21 components); x = -3/10: 50.6 d (pair
  43.7 d; identical (60) for 21 of 21 components); the controls x = -1 vs the stored x = -1 string 63.1 d, x = -2 vs the stored oracle string
  63.1 d (dps 45).
  USAGE
    python3 icc-evaluate.py --land                              # dps 60: the landing, the certificates, the gate (bar 50)
    python3 icc-evaluate.py --land --dps 110 --pair             # the record's pair tier (dps 110 / 140): hour-class
    python3 icc-evaluate.py --land --dps 60 --second-radius     # + the circle at rho/2 (the two-radius check)
    python3 icc-evaluate.py --land --mutate                     # the control: the gate FAILS by name (exit 1)
    python3 icc-evaluate.py --band=-9/20                        # the band: the integral (dps 45 / 60) beside the detours (dps 60)
    python3 icc-evaluate.py --band=-1/2                         # the integral at -1/2 vs the record
    python3 icc-evaluate.py --band=-1 --euclid-control          # the control: the integral vs the served march and the x = -1 string
    python3 icc-evaluate.py --band=-1/5                         # REFUSED (exit 2): outside the band
  EXIT CODES (both arms): 0 PASS | 1 a certificate, control or gate below its bar (FAIL by name; also the expected
    outcome of --mutate) | 2 REFUSED by name (a radius outside 0 < R <= 1/8, fewer than 16 legs, a point outside the
    band, an option of another arm, --mutate below dps 40 or off the record point) | 3 the record's pin mismatch |
    4 the record missing | 6 the negative control NOT caught.
  WALLS (measured on the delivered bytes' arm units, one process at nice 10 in a 200 % CPU scope on a shared 96-core host
    at loadavg 206-200, a dozen of these runs concurrent; contended figures, never a projection):
    --land --dps 30 105 s; --land --dps 60 220 s (seeds 138 s); --land --dps 60
    --second-radius 227 s; --land --dps 60 --pair 493 s; --land --dps 110 397 s
    (seeds 258 s); --land --dps 140 635 s (seeds 397 s, the circle
    133 s for 258 sample points in 22 expansions) -- the record's pair tier run as two
    independent pieces, their pair floor over the 21 components as printed 109.9 d at (2,0) (dps 110 vs 140) (the arm's --pair rule);
    --band=-9/20 295 s; --band=-3/10 373 s; --band=-1/2 73 s;
    --band=-1 --euclid-control --dps 30 99 s.  The record's own engine (a different implementation of
    the same construction) took 16:25.90 (dps 110) and 28:28.12 (dps 140) wall.

THE ONE-FOLD FAST PATH (2026-09-11): --onefold X [--dps N] [--config eqmass|generic] [--mutate]
  THE FORM.  Written through the scoop's spectral mass s, the whole eps^0 top master on the slice (p12^2 = p34^2 = x,
  p56^2 = -1) is a one-fold integral of logarithms.  Loop by loop: the scoop bubble (squared masses m3, m4) is a
  spectral propagator of squared mass s on [s0, inf), s0 = (sqrt m3 + sqrt m4)^2, with density 2 / sqrt(lambda(s, m3,
  m4)); what is left is the d = 2 one-loop triangle with lines (m1, m2, s) at the invariants p56^2 (the vertex of the
  two cone lines), x and x, and a d = 2 triangle reduces EXACTLY to its three d = 2 bubbles, Tri = sum_i b_i I2^(i)
  with b = Y^{-1} (1, 1, 1)^T (Y the modified Cayley matrix; removing line i leaves the bubble of the other two lines
  at their common vertex), each bubble a logarithm in closed form:
      T(x) = 2 int_{s0}^inf ds / sqrt(lambda(s, m3, m4))  Tri_{d=2}(m1, m2, s; p56^2, x, x)      (any squared masses).
  At equal mass (m^2 = 1, s0 = 4) the same integral is the display form of the accompanying text,
      T(x) = 2 int_4^inf ds / sqrt(s (s - 4))  [2 (c - 2 s) B(s; x) + (2 c - 5) Tri0] / (2 c^2 - 10 s),   c = s + 1 - x,
      B(s; x) = int_0^1 da / (a + s (1 - a) - x a (1 - a))     (the d = 2 bubble of squared masses 1 and s at p^2 = x),
      Tri0 = 4 ln(phi) / sqrt 5     (the d = 2 bubble at p56^2 = -1; phi the golden ratio),
  the one-fold reduction of the written two-fold integral (58) that the --band arm evaluates in its dispersion form
  (there the inner alpha-fold is closed at each s and the outer fold is the same spectral s; here the triangle is
  reduced to bubbles first).  Its Tri0 term is elementary (the residues at the cone's Landau points s_pm(x) = ((3 +
  2 x) pm sqrt 5 sqrt(4 x + 1)) / 2, the zeros of 2 c^2 - 10 s); the rest is a length-two elliptic polylogarithm on
  the scoop curve with third-kind punctures at s_pm(x).  No boundary constant, no cusp solve and no transport enter:
  the arm is a certified quadrature of logarithms (the outer s-fold, the threshold turn-on removed by s = s0 + t^2,
  is one tanh-sinh on [0, inf) with breakpoints, certified fail-closed by the served quad_certified at 10^-(dps + 2),
  working precision dps + 10; each bubble at guard digits against the large-s cancellation of its two logarithms,
  the coincident-root case exactly).  The DE-transport path stays the default and every served gate is unchanged:
  these are new units (onefold_*), called by nothing else.
  THE DOMAIN.  Real x below the cone's lowest normal threshold on the slice, (sqrt m_i + sqrt m3 + sqrt m4)^2 for the
  lighter cone line i: x < 9 at equal mass, x < (1 + sqrt 3 + sqrt 5)^2 = 24.68... at the generic squared masses
  (1,2,3,5); X an exact rational or a decimal.  Below the threshold every inner bubble is below its own threshold and
  the form is real: for x < -1/4 the Landau points s_pm are complex; for -1/4 <= x < 5 - 2 sqrt 5 they are real and
  below the contour; above it s_+ lies ON the contour and the numerator of the display form vanishes there with the
  denominator (a removable point: the value is regular through it, and through x = 0 and x = 1, real singular points
  of the connection where this master is finite); between an inner bubble's pseudo-threshold and its threshold the
  two roots of its quadratic are complex conjugates and the closed form is complex-typed with a cancelling imaginary
  part (the residue |Im| / max(|Re|, 1) is printed and gated).  At and above the threshold the arm REFUSES by name
  (exit 2): the physical region there needs the s-contour deformation, which this arm does not carry (at equal mass
  the --minkowski X arm transports the connection to x + i0 instead).  So at eps^0 and for the top master alone this
  arm covers the stretch -1/2 < x < 9 of the equal-mass slice that the real-axis transport does not reach (the
  --land arm gives x = -1/2 and the --band arm -1/2 <= x < -1/4 by two routes each).
  PRINTED AND GATED (every gate RAISING, exit 1 by name below its bar; each bar = the compared count - 8).  The value
  at dps (default 60) and at dps + 30: the two-precision self-check (60 / 90 by default), its floor the count the
  integral certifies (capped at dps; bar dps - 8); the imaginary residue (bar 10^-(dps - 8)); at equal mass the
  SECOND ASSEMBLY -- the general spectral form (the triangle (1, 1, s) reduced to bubbles) beside the display form,
  two assemblies of the same integral (bar dps - 8) -- and Tri0 by the closed-form bubble vs 4 ln(phi) / sqrt 5 (bar
  dps - 8); at X = -1 the comparison with the stored x = -1 string of the top master (icc-transport-data.json, the
  boundary block's eps^0 entry: 330 d at equal mass, 210 d at the generic masses) and at X = -2 with the stored
  AMFlow oracle string ORACLE[(cfg, 0)] (330 d / 210 d), bar min(the pair, the string's digits, dps) - 8; the
  agreement is printed with the string's length as 'N of L', N capped at the digits the two-precision pair
  certifies (at most dps; when the comparison reads more digits than that, the reading is printed beside the
  count), and reads 'reference-capped' only when N is the string's full length L.  Anywhere else no stored string
  exists and the run says so: the pair (and at equal mass the second assembly) is the certificate.  --mutate (at
  X = -1 or -2, dps >= 30) is the NEGATIVE CONTROL: the stored string perturbed at its 20th significant digit in
  memory (mutate_digit; the file untouched) -- the comparison MUST fail by name (exit 1; exit 6 if not caught).
  NOT ESTABLISHED by this arm: the eps^1 layer (the one-fold form is the eps^0 top master; T^(1) stays the
  transport's); the other six / eighteen masters; the physical region x >= the threshold (no contour deformation
  here); a stored comparison anywhere but x = -1 and x = -2 (inside -1/2 <= x < 9 the values on file by other routes
  are the --land / --band arms' at -1/2, -9/20, -3/10 and the --minkowski arm's x + i0 values; this arm does not read
  them -- the comparison at x = 5 with the --minkowski arm is in CHANGES.md, the entry of 2026-09-11); at the generic
  masses no second assembly (the display form is the equal-mass one).
  USAGE
    python3 icc-evaluate.py --onefold=-1                       # equal mass, dps 60 / 90: the value, the pair, the second assembly, vs the 330-d x = -1 string
    python3 icc-evaluate.py --onefold=-2 --dps 345             # vs the 330-d oracle string at its full length
    python3 icc-evaluate.py --onefold=-1 --config generic      # the squared masses (1,2,3,5) vs the 210-d x = -1 string
    python3 icc-evaluate.py --onefold=5                        # below threshold, no stored string: the value, the pair, the second assembly
    python3 icc-evaluate.py --onefold=-1 --mutate              # the control: the comparison FAILS by name (exit 1)
    python3 icc-evaluate.py --onefold=9                        # REFUSED (exit 2): the threshold
  EXIT CODES (this arm): 0 PASS | 1 a gate below its bar (FAIL by name; the expected outcome of --mutate) | 2 REFUSED
    by name (X at or above the threshold, a non-rational X, --config both, an option of another tier or arm, --dps
    below 15, --mutate off X = -1 / -2 or below dps 30) | 6 the --mutate control NOT caught.
  WALLS: the arm is a quadrature, not a transport; the measured figures of the delivered bytes are in CHANGES.md
    (the entry of 2026-09-11).
"""
import argparse
import json
import os
import re
import time
from mpmath import mp, mpf, quad, besselj, besselk, sqrt, log10, fabs, log, pi, euler

import sys as _sys  # subprocess interpreter for the vendored G1 runner

import icc_blib as blib
from icc_scooplib import Scoop

# staged generic-mass fold: sha-pinned A' specializer (same dir)
import icc_genmass_lib as gml

HERE = os.path.dirname(os.path.abspath(__file__))
DATA = json.load(open(os.path.join(HERE, "icc-transport-data.json")))
DERIVED = json.load(open(os.path.join(HERE, "icc-derived.json")))

X_TARGET = -2  # held-out point; any x < -1/2 works (transport recomputes)

# ---------------------------------------------------------------------------
# (a) Held-out AMFlow oracle literals at x=-2 (provenance in the docstring).
#     These are the ONLY gate-point numbers in this file; the "this work"
#     column below is transported at runtime and is NOT stored anywhere.
# ---------------------------------------------------------------------------
# 2026-09-06: the two equal-mass strings below are the FULL 330-significant-digit
# midpoints of the AMFlow record e1hp_xm2_g320_out.json
#   (sha256 cd1e9d03ef04fb445e633afcd2334fcb0b29c71fb02bc87e30e36d1eb59b1966, 15187 bytes;
#   input e1hp_xm2_g320.json sha256 2828bd7a5e577ce03a7d60504fcd97032ec99d8d37ecbc19a3bf49c445df2aad):
#   mode solve_integrals, family icc (7 propagators, m^2 = 1 on all four massive lines),
#   goal_digits 320, eps_order 6, d0 2, numeric_values p12sq = -2, p34sq = -2,
#   p56sq = -1, msq = 1 (x = -2 on the symmetric slice), n_thread 14, ending_schemes
#   Tradition + SingleMass, ibp_dot 2, integral_order 5; result[4] = integral
#   [1,1,1,1,0,0,0] (the top master); eps^0 ball radius 1.04e-331, eps^1 ball radius
#   3.85e-331, imaginary parts 0/0.  The literals shipped before
#   (199 d eps^0 / 198 d eps^1) are byte-identical prefixes (truncations) of
#   these strings; the value path is untouched, only the comparison strings changed.
# 2026-09-06 (the generic-cone oracle deepened): the generic eps^0 string below is the
#   FULL 210-significant-digit midpoint of the AMFlow out P16G150WP200_xm2.json
#   (sha256 e6f8ce6089eae39f3916c3e192f4e755b6a2ec18aa5e0d59c2b448cbf42f9ec5; the record of that run is
#   the settled receipt sha256 b0eedb97fe87fae6...): the same family iccg at masses^2
#   (1,2,3,5), goal_digits 150, eps_order 4 (orders -4..0: this out carries NO eps^1
#   order), options.working_pre 200 (the print depth; the run's internally tuned
#   working precision was 930 digits), x = -2 (p12sq = p34sq = -2, p56sq = -1);
#   result[15] = the top master [1,1,1,1,0,0,0], eps^0 ball radius 1.24e-211,
#   imaginary part 0.  The 110-d literal shipped before agrees with it to 109.91 d
#   (its last digit rounded); digits 111-210 are the printed midpoint of ONE precision
#   (the two-precision pair against the goal-100 record certifies 109 of them).
#   The generic eps^1 string keeps its 110 d (a deeper eps^1 needs eps_order 5).
ORACLE = {
    ("eqmass", 0): "0.561938408623751111800296111331296770045498624531637846402417311990362022480842934827267137899489857973423737077241497536964256108606674703258078694824487126660148116143647019762713961362441796733317952176571880045394520021298900263781463447125636944984054251085045637319240634383311610839550156770808205814461587292559621318394746",
    ("eqmass", 1): "-0.684740153698421594298924419525598980491805192640429670131187103522719051531067091216524388331559676060891087497904544220998570824521916515836995414386796916837225409824305568299666811846897677161873014664263891675236647450982766093559329666400267360698393874857813285583592323068979134422980007563169554360755392189091368418674176",
    ("generic", 0): "0.131007888684361635237818480170717295089677192033391035321515436605824179802785536282628982073648417882558842178392478105603311352136446173646384918955330938909384991879985519653797563683923156540419652809601496",
    ("generic", 1): "-0.37086827190514918769973270564178085398496490001350230583436543288823915349850401365936722828477498077427159443",
}
# Independent verify-harness values (separate AMFlow process, eps^0 only):
# 2026-09-06: the generic string below is KEPT as shipped (110 d) -- it is the one
#   x = -2 comparison string that does not come from the run behind the oracle
#   string above (a separate verify-harness process, 2026-07); against the 210-d
#   oracle string it reads 105.12 d, its own depth; its gate bar stays
#   min(the oracle bar, its length - 11).
ORACLE_VERIFY = {
    ("eqmass", 0): "0.56193840862375111180029611133129677004549862453163784640241731199036202248084293482726713789948985797342373708",
    ("generic", 0): "0.13100788868436163523781848017071729508967719203339103532151543660582417980278553628262898207364841788255874220",
}

# ---------------------------------------------------------------------------
# (a') A third gate point on the slice (2026-09-06): the AMFlow value of the
#      generic top master at x = -3 (p12sq = p34sq = -3, p56sq = -1; masses^2
#      (1,2,3,5); goal_digits 55, eps_order 6; 110-d strings), vendored beside
#      this file as icc-oracle-xm3.json (sha256-pinned below; its strings verbatim
#      from the out ge1_xm3_out.json, sha256 b74826fa284c16e7...).  Never a
#      transport input: --config generic --point -3 gates the transported eps^0
#      and eps^1 against it in the x = -2 gate's form, string-capped at 110 d.
# ---------------------------------------------------------------------------
ORACLE_XM3 = {
    "file": "icc-oracle-xm3.json",
    "sha256": "1bfacfa60a435b70fc89435bff5f315c5974224a1838b44dffc1ddc6025eefc8",
    "x": -3,
    "config": "generic",
    "orders": (0, 1),
    "exit_code_mismatch": 3,   # the bundle's pin codes (icc-genmass-evaluate.py's)
    "exit_code_missing": 4,
}
_XM3 = {"data": None, "strings": None, "mutate": False}


def load_oracle_xm3():
    """The vendored x = -3 oracle read through its sha256 pin (fail closed, by
    name): exit 4 when the file is missing beside this script, exit 3 on a pin
    mismatch; returns (the object, {order: string})."""
    import hashlib
    p = os.path.join(HERE, ORACLE_XM3["file"])
    if not os.path.exists(p):
        print(f"icc-evaluate MISSING: pinned file {ORACLE_XM3['file']} is absent "
              f"beside this file (the x = {ORACLE_XM3['x']} oracle); not serving "
              f"--point {ORACLE_XM3['x']}", flush=True)
        raise SystemExit(ORACLE_XM3["exit_code_missing"])
    got = hashlib.sha256(open(p, "rb").read()).hexdigest()
    if got != ORACLE_XM3["sha256"]:
        print(f"icc-evaluate REFUSED: {ORACLE_XM3['file']} integrity pin mismatch: "
              f"sha256 {got} != pinned {ORACLE_XM3['sha256']}; not serving "
              f"--point {ORACLE_XM3['x']}", flush=True)
        raise SystemExit(ORACLE_XM3["exit_code_mismatch"])
    o = json.load(open(p))
    strings = {int(k): v["mid"] for k, v in o["top_master"]["eps"].items()}
    src = o["_provenance"]["source"]
    print(f"  [pin] {ORACLE_XM3['file']} sha256 {got[:16]}... VERIFIED "
          f"({os.path.getsize(p)} bytes): the x = {o['x']} oracle, "
          f"{len(strings)} strings of {sig_digits(strings[0])} d (out "
          f"{src['name']} {src['sha256'][:16]}...)")
    return o, strings


def mutate_digit(s, n):
    """NEGATIVE CONTROL helper: the n-th significant digit of the decimal string
    s replaced by (digit + 1) mod 10 (sign, point and leading zeros skipped)."""
    k = 0
    out = list(s)
    started = False
    for i, ch in enumerate(out):
        if ch.isdigit() and (started or ch != "0"):
            started = True
            k += 1
            if k == n:
                out[i] = str((int(ch) + 1) % 10)
                return "".join(out)
    raise ValueError("the string has fewer significant digits than n")


def gate_xm3(cfg, x, vals, top_i, cfg_dps):
    """The x = -3 gate (2026-09-06): the transported top master vs the vendored
    AMFlow oracle strings (ORACLE_XM3), in the x = -2 gate's form -- the same cap
    rule and bars, the cap string-capped at the 110 d the out prints."""
    o = _XM3["data"]
    cfgo = o["_provenance"]["config"]
    for k in ORACLE_XM3["orders"]:
        s = _XM3["strings"][k]
        note = ""
        if _XM3["mutate"] and k == 0:
            s = mutate_digit(s, 20)
            note = (" [NEGATIVE CONTROL: the vendored eps^0 string perturbed at its "
                    "20th significant digit in memory -- the gate MUST fail]")
        v = vals[(top_i, k)]
        d = agree_digits(v, s)
        cap = min(sig_digits(s), boundary_seed_digits(cfg, cfg_dps), cfg_dps + 17)
        print(f"\n  {CONFIG_LABEL[cfg]}, TOP eps^{k} at x={x} (the vendored oracle "
              f"{ORACLE_XM3['file']}: goal {cfgo['goal_digits']}, eps_order "
              f"{cfgo['eps_order']}, {sig_digits(s)} d){note}")
        print(f"    this work (computed now): {mp.nstr(v, 50)}")
        print(f"    AMFlow oracle (vendored) : {s[:52]}...")
        print(f"    agreement (recomputed)  : {d:.1f} d")
        if d >= cap - 3:
            print(f"    [agreement CAPPED at ~{cap} d = min(vendored oracle string "
                  f"{sig_digits(s)} d (string-capped), boundary cap "
                  f"{boundary_seed_digits(cfg, cfg_dps)} d, dps)]")
        gate_bar = min(cfg_dps, cap) - 6
        brec_note = ""
        if _BREC["overlay"] is not None:
            gate_bar = min(gate_bar, _BREC["bdps"] - 13)
            brec_note = f"; recompute floor class BDPS {_BREC['bdps']} - 13"
        if k == 1 and _G1["overlay"] is not None:
            gate_bar = min(gate_bar, _G1["dps"] - 13 - 6)
            brec_note += f"; GEN_G1 fold floor g1dps {_G1['dps']} - 13"
        print(f"    [gate] bar {gate_bar:.1f} d (min(dps, printed cap) - 6"
              f"{brec_note}); below-bar RAISES (rc!=0)")
        if not (d >= gate_bar):
            raise RuntimeError(
                f"ICC {cfg} TOP eps^{k} x={x} vendored-oracle gate FAIL (below bar "
                f"=> nonzero exit): {d:.1f} d < bar {gate_bar:.1f} d (dps {cfg_dps}, "
                f"cap {cap} d, string-capped at {sig_digits(s)} d)")


# per-config runtime settings: (dps, taylor order, per-step radius fraction)
SETTINGS = {"eqmass": (135, 120, 0.10), "generic": (120, 100, 0.09)}
KMIN, KMAX = -2, 1  # eps-Laurent orders carried (deepest pole -2 .. weight-4 layer)

# axis3 wave 2026-07-05: generic scoop seed RAISING gate (generic_runtime_seeds).
# Guard 10 = mid of the charter 8-12 band; measured mdeg/mdeg+1 agreement is
# EXACT (diff == 0) at dps 30-180 (axis3_wave/row16/scoop_calib.log) =>
# infinite headroom, healthy runs never escalate.  Cap +6 degrees ~ 64x nodes.
SCOOP_GUARD = 10        # gate tol = 10^-(dps + SCOOP_GUARD)
SCOOP_MDEG_CAP_ADD = 6  # mdeg escalation cap = starting mdeg + 6
# axis3 wave 2026-07-05 (quick-win 10, shared rows-15/16/17 quadratures): the
# I1 triangle quadrature runs through blib.quad_certified (pass 0 = legacy
# call bit-for-bit; engine estimate < 10^-(dps+I1_GUARD) keyed to the CONSUMER
# dps -- the +40 ambient digits are working margin, not the bar; maxdegree
# doubles on failure, RuntimeError at cap).  blib J/K2c + period_T_eps0 gates
# live in icc_blib.py; vendored row16_solve.py J12 gets the same at bdps+10.
# Calibration (measured probe): I1 est 1e-166 at default ambient 160 vs tol 1e-130.
I1_GUARD = 10           # I1 quad tol = 10^-(dps + I1_GUARD)

# generic-mass runtime seed spec (row-16 fold; see icc-derived.json)
_GSPEC = DERIVED["generic_runtime_seed_spec"]
TADPOLES = tuple((i, P) for i, P in _GSPEC["tadpoles"])
TRIANGLES = tuple((i, P) for i, P in _GSPEC["triangles"])
SUNRISES = tuple((i, tuple(c)) for i, c in _GSPEC["sunrises"])
GEN_REPLACED = ({(i, K) for i, _ in TADPOLES for K in (-2, -1, 0)}
                | {(i, K) for i, _ in TRIANGLES for K in (-1, 0)}
                | {(i, 0) for i, _ in SUNRISES})

# --boundary-recompute state (2026-07-05 wiring + slot5 fix): overlay
# of ALL 25 generic retained literals, recomputed at runtime; None =
# default mode (stored strings consumed as before).
_BREC = {"overlay": None, "bdps": None, "cache": None, "wall": None}

# GEN_G1 eps^1 fold state (rev-2): ALL 19 grade-1 seeds derived-or-injected
# at runtime; the fold runs in EVERY generic mode (no string-input mode for
# K=1 — the stored '1' strings are held-out compare gates ONLY, and
# build_system hard-RAISES if any would be read as y0).
_G1 = {"overlay": None, "dps": None, "wall": None, "gate": None}
G1_DERIVED_MASTERS = (0, 1, 2, 3, 4, 5, 9, 10, 11, 15, 17)
G1_INJECTED_MASTERS = (6, 7, 8, 12, 13, 14, 16, 18)   # NEPS=4 FINAL slots
G1_ALL_MASTERS = tuple(sorted(G1_DERIVED_MASTERS + G1_INJECTED_MASTERS))
# hard guard (Test A): demoted grade-1 keys must
# never be reachable as transport inputs on any value path in any mode
G1_GUARDED_KEYS = frozenset((i, 1) for i in G1_ALL_MASTERS)
# sha-pin of the ADDITIVE NEPS=4 FINAL slave-slot file (RESULT3.json untouched;
# its pin in g1_vendored/VENDOR_SHAS.txt stays valid)
RESULT3_FINAL_SHA256 = \
    "68e98ac8be354d79af89a12829928038ec85c61587738df6e2c6365acad301bf"


# ---------------------------------------------------------------------------
# Taylor tools for exact rational functions p(x)/q(x) (integer coeff lists).
# ---------------------------------------------------------------------------
def poly_shift(coeffs, x0, order):
    """Taylor coeffs of p(x0+s) in s, truncated at 'order' (synthetic division)."""
    c = [mpf(ci) for ci in coeffs]
    n = len(c)
    out = []
    for _ in range(min(n, order + 1)):
        # divide c(x) by (x - x0): remainder = value, quotient carries on
        rem = c[-1]
        q = [mpf(0)] * (len(c) - 1)
        for i in range(len(c) - 2, -1, -1):
            q[i] = rem
            rem = c[i] + rem * x0
        out.append(rem)
        c = q
        if not c:
            break
    out += [mpf(0)] * (order + 1 - len(out))
    return out


def rat_taylor(num, den, x0, order):
    """Taylor coeffs of p/q about x0 (series division; q(x0) != 0 on the path)."""
    p = poly_shift(num, x0, order)
    q = poly_shift(den, x0, order)
    q0 = q[0]
    nq = len(den)  # only first min(nq, order+1) den coeffs are nonzero
    c = [mpf(0)] * (order + 1)
    for n in range(order + 1):
        s = p[n]
        for k in range(1, min(n, nq - 1) + 1):
            s -= q[k] * c[n - k]
        c[n] = s / q0
    return c


# ---------------------------------------------------------------------------
# Runtime boundary seeds (back-port of the folded row-15/16/17 scripts).
# ---------------------------------------------------------------------------
_SEED_CACHE = {}


def eqmass_derived_seeds(dps):
    """Rows-15/17 fold: derive ALL eq-mass x=-1 seeds (grades eps^-2..eps^1)
    at runtime from the infinity-cusp analytic conditions (icc_blib; NO
    AMFlow input).  Returns (seeds, diag, defit, wall); cached per dps."""
    key = ("eqmass", dps)
    if key in _SEED_CACHE:
        return _SEED_CACHE[key]
    derive_dps = dps + 25                     # measured loss ~3-8 d; margin 25
    nser = 2 * derive_dps + 30                # scoop-series radius 1/9: N ~ 1.91*d
    t0 = time.time()
    seeds, diag = blib.derive_eqmass_seeds(DATA["eqmass"],
                                           DERIVED["exact_scalar_ode"],
                                           derive_dps, nser, grade=1)
    wall = time.time() - t0
    # runtime de-fit check: derived seeds vs superseded oracle strings
    # (held-out reference only -- NOT used in any computation; (6,1) excluded:
    # seeded 0, proven top-null at this truncation, gated upstream)
    mp.dps = derive_dps + 30
    defit = min(blib.agree_digits(v, DATA["eqmass"]["boundary"][str(i)][str(K)])
                for (i, K), v in seeds.items() if (i, K) != (6, 1))
    # the top master's own de-fit (its x=-1 strings carry 330 d since
    # 2026-09-06; the grades the derivation carries), printed beside the min
    top_i = DATA["eqmass"]["top_index"]
    diag["top_defit"] = [
        (K, sig_digits(DATA["eqmass"]["boundary"][str(top_i)][str(K)]),
         blib.agree_digits(seeds[(top_i, K)],
                           DATA["eqmass"]["boundary"][str(top_i)][str(K)]))
        for K in (0, 1, 2) if (top_i, K) in seeds]
    diag["derive_dps"], diag["nser"] = derive_dps, nser
    _SEED_CACHE[key] = (seeds, diag, defit, wall)
    return _SEED_CACHE[key]


def generic_runtime_seeds(dps):
    """Row-16 fold (PARTIAL): the 21 replaced generic x=-1 seeds, computed at
    runtime — tadpole^2/triangle closed forms + live scooplib spectral
    integrals.  Returns (overlay, conv, defit, wall); cached per dps."""
    key = ("generic", dps)
    if key in _SEED_CACHE:
        return _SEED_CACHE[key]
    t0 = time.time()
    mp.dps = dps + 40
    g = +euler
    z2 = pi ** 2 / 6
    out = {}
    for i, P in TADPOLES:      # Gamma(eps)^2 P^-eps (boundary closed forms)
        lP = log(P)
        out[(i, -2)] = mpf(1)
        out[(i, -1)] = -(2 * g + lP)
        out[(i, 0)] = 2 * g * g + z2 + 2 * g * lP + lP * lP / 2
    # triangles: -Gamma(eps) P^-eps Gamma(1+eps) Int_0^1 (2-a^2)^(-1-eps) da
    W = log(1 + sqrt(2)) / sqrt(2)            # = Int da/(2-a^2), exact
    # axis3 wave 2026-07-05: I1 CERTIFIED fail-closed (blib.quad_certified;
    # engine estimate < 10^-(dps+I1_GUARD) or maxdegree doubles, RuntimeError
    # at cap).  Tol keys to the consumer dps -- the +40 ambient digits are
    # working margin, not the certification bar.
    _i1, _i1_est = blib.quad_certified(
        lambda a: log(2 - a * a) / (2 - a * a), [0, 1], dps + I1_GUARD,
        name="row16 I1 triangle quadrature")
    I1 = -_i1
    print(f"  [I1 CERTIFIED: engine estimate {mp.nstr(_i1_est, 3)} < tol "
          f"1e-{dps + I1_GUARD} (fail-closed)]")
    for i, P in TRIANGLES:
        out[(i, -1)] = -W
        out[(i, 0)] = (2 * g + log(P)) * W - I1
    # sunrises S, S14: LIVE materialized spectral integral (period route).
    # axis3 wave 2026-07-05: the mdeg/mdeg+1 agreement is a RAISING gate --
    # the two-successive-depth agreement must beat 10^-(dps+SCOOP_GUARD) or
    # mdeg escalates (EXACT same quadrature, one degree deeper per try) to
    # cap mdeg0+SCOOP_MDEG_CAP_ADD, then RuntimeError (fail closed).  The
    # closed-form mdeg0 = 10 + max(0,(dps-90)//60) survives as the STARTING
    # guess only.  Never print/seed a value the gate didn't certify.
    mp.dps = dps + 30
    mdeg = 10 + max(0, (dps - 90) // 60)
    conv = float("inf")
    tol = mpf(10) ** (-(dps + SCOOP_GUARD))
    for i, cfg in SUNRISES:
        s = Scoop(*cfg)
        m = mdeg
        v = s.S0(mpf(-1), maxdegree=m)
        v2 = s.S0(mpf(-1), maxdegree=m + 1)
        d = fabs(v - v2)
        while d != 0 and d / fabs(v2) >= tol:
            if m >= mdeg + SCOOP_MDEG_CAP_ADD:
                raise RuntimeError(
                    f"scoop seed gate FAILED: sunrise {cfg} mdeg/mdeg+1 "
                    f"agreement {mp.nstr(d / fabs(v2), 3)} >= tol "
                    f"{mp.nstr(tol, 3)} = 10^-(dps {dps} + guard "
                    f"{SCOOP_GUARD}) at maxdegree {m}/{m + 1} (start {mdeg}, "
                    f"cap {mdeg + SCOOP_MDEG_CAP_ADD}) -- refusing to seed "
                    f"the transport (fail closed)")
            m += 1
            v = v2
            v2 = s.S0(mpf(-1), maxdegree=m + 1)
            d = fabs(v - v2)
        out[(i, 0)] = v2
        conv = min(conv, float("inf") if d == 0 else
                   float(-log10(d / fabs(v2))))
    # runtime de-fit check: replaced seeds vs superseded oracle strings
    mp.dps = dps + 40
    defit = min(blib.agree_digits(v, DATA["generic"]["boundary"][str(i)][str(K)])
                for (i, K), v in out.items())
    _SEED_CACHE[key] = (out, conv, defit, time.time() - t0)
    return _SEED_CACHE[key]


def generic_boundary_recompute(bdps):
    """Boundary-recompute wiring (2026-07-05) + slot5 fix (production gate PASS 25/25 at
    the full stored-string bar, min 109.6 d -- icc_slot5/RESULT.md,
    e2e_corr140fix / e2e_corr160fix2): recompute ALL 25 generic retained x=-1
    literals at runtime.

      (1) 7 rationals (i,-2), i in {6,7,8,12,13,14,18} and
      (2) 8 K=-1 closed forms (i,-1), i in {6,7,8,12,13,14,16,18}: sympy srepr
          from icc_layers_generic.json at x=-1 with {g, L2, L3, L5, W}.
      (3)+(4) 10 grade-0 literals (i,0), i in {6,7,8,12,13,14,15,16,17,18}:
          vendored cusp solver (row16_final + stack, icc_production decider
          copies, now with the slot5 two-pass E_F fix in
          row16_coupled.solve_coupled) with the DERIVED slave resonance slots
          injected DATA-DRIVEN from icc_slots_result.json
          (free_vals={(n,0): val}) and lifted-order transport, order ~ 1.2*bdps.
      (5) (16,0)/(18,0) FIXED 2026-07-05 (formerly vendored OPEN): the
          "u^(1/2) rank-6 dotted-seed defect" was a solve_coupled E_F
          forward-reference bug (level-(n+1) T-contributions silently
          dropped; fifth dof = 0 -- icc_slot5/RESULT.md sections 1-3).
      (6) the 25 recomputed strings demote to a compare-on-load CACHE.

    D2 FOLD-TIME MAP (masters 6-8): values are in the CURRENT 'generic' basis;
    at ICC fold time masters {5,6,7,8} re-mix by the unitriangular
    x-independent D2 rotation (BASIS_ROTATION_DIAGNOSTIC.md).  The rotation
    preserves runtime-computable status; every K=-2..0 component of masters
    6,7,8 entering a fold-time mix is runtime-computable -- including mixes
    touching masters 16/18 at K=0 (former OPEN inheritance lifted by the
    slot5 fix).  Apply at fold time only.
    """
    import sympy as sp
    t0 = time.time()
    old_dps = mp.dps
    overlay = {}
    layers = json.load(open(os.path.join(HERE, "icc_layers_generic.json")))
    srepr = layers["closed_forms_srepr"]
    subs = {sp.Symbol('x'): sp.Integer(-1),
            sp.Symbol('g', positive=True): sp.EulerGamma,
            sp.Symbol('L2', positive=True): sp.log(2),
            sp.Symbol('L3', positive=True): sp.log(3),
            sp.Symbol('L5', positive=True): sp.log(5),
            sp.Symbol('W', positive=True): sp.log(1 + sp.sqrt(2)) / sp.sqrt(2)}
    with mp.workdps(bdps + 15):
        for i in (6, 7, 8, 12, 13, 14, 18):          # (1) K=-2 rationals
            v = sp.N(sp.sympify(srepr[f"f{i}_-2"]).subs(subs), bdps + 10)
            overlay[(i, -2)] = mpf(str(v))
        for i in (6, 7, 8, 12, 13, 14, 16, 18):      # (2) K=-1 closed forms
            v = sp.N(sp.sympify(srepr[f"f{i}_-1"]).subs(subs), bdps + 10)
            overlay[(i, -1)] = mpf(str(v))
    import row16_final
    NSER = max(2 * bdps, 60)
    torder = int(-(-12 * bdps // 10))                # ceil(1.2*bdps)
    print(f"    [boundary-recompute] cusp solve + lifted transport: "
          f"dps={bdps}, NSER={NSER}, order={torder} (order ~ 1.2*dps)")
    res = row16_final.run(bdps, NSER, torder=torder, tfrac='0.10',
                          tag=None, dump_state=False)
    y, yidx = res['y'], res['idx']
    for i in (6, 7, 8, 12, 13, 14, 15, 16, 17, 18):  # (3)+(4) grade-0
        overlay[(i, 0)] = y[yidx[(i, 0)]]            # 16/18: slot5 fix (5)
    # (6) compare-on-load cache check of the demoted strings.
    # axis3 wave 2026-07-05: this check now RAISES (was WARNING print) --
    # any recomputed literal outside the demoted string's resolution at this
    # bdps is a fail-closed error.  The need formula is unchanged (= the
    # measured resolution model; healthy margins: min 19.3 d vs
    # need 15 at bdps 30, min 109.6 d vs need 95 at bdps 140/160).
    cache = []
    fails = []
    with mp.workdps(bdps + 40):
        for (i, K), v in sorted(overlay.items()):
            s = DATA["generic"]["boundary"].get(str(i), {}).get(str(K))
            if s is None:
                continue
            d = blib.agree_digits(v, s)
            # closed forms track bdps; transported grade-0 entries carry a
            # measured ~10-12 d step-roundoff floor below bdps (measured model)
            need = min(sig_digits(s), bdps) - (15 if K == 0 else 3)
            cache.append((i, K, d, d >= need))
            if d < need:
                print(f"    [boundary-recompute] CACHE WARNING ({i},{K}): "
                      f"recomputed vs demoted string {d:.1f} d < {need} d")
                fails.append((i, K, d, need))
    mp.dps = old_dps
    if fails:
        raise RuntimeError(
            f"--boundary-recompute compare-on-load cache check FAILED at "
            f"bdps {bdps}: " + "; ".join(
                f"({i},{K}) recomputed vs demoted string {d:.1f} d < need "
                f"{need} d" for i, K, d, need in fails) +
            " [need = min(sig_digits, bdps) - (15 if K==0 else 3), the "
            "measured resolution model] -- refusing to return the "
            "overlay (fail closed)")
    return overlay, cache, time.time() - t0


def generic_g1_recompute(g1dps, mutate=None):
    """GEN_G1 eps^1 fold, REV-2: ALL 19 generic grade-1 (eps^1) x=-1 seeds at runtime --
    the 11 derivable seeds DERIVED from infinity-cusp analytic conditions
    and the 8 slave-master seeds solved with the NEPS=4 FINAL grade-1 slave
    slots INJECTED from the sha-pinned RESULT3_FINAL.json (vendored
    boundary-derivation row16_g1_v2 stack, VENDOR_SHAS.txt; subprocess isolation
    -- its module names shadow this file's own vendored grade-0 stack).
    The 19 stored AMFlow strings DEMOTE to held-out compare gates: any
    derived-or-injected seed outside the demoted string's resolution at
    this g1dps RAISES (fail closed).  Reference-exhausted 19/19: at a
    dps145 check the 8 injected seeds agree 109.4-110.9 d =
    string-capped."""
    import hashlib
    import subprocess
    g1dir = os.path.join(HERE, "g1_vendored")
    if not os.path.exists(os.path.join(g1dir, "run_g1_json.py")):
        raise RuntimeError(f"GEN_G1 vendored stack absent at {g1dir} "
                           f"(fail closed)")
    # sha-pin gate on the ADDITIVE FINAL slave-slot file (fail closed)
    fpath = os.path.join(g1dir, "gen_g1_mellin", "RESULT3_FINAL.json")
    if not os.path.exists(fpath):
        raise RuntimeError(f"GEN_G1 RESULT3_FINAL.json absent at {fpath} "
                           f"(fail closed; rev-2 requires the NEPS=4 FINAL "
                           f"slave slots)")
    fsha = hashlib.sha256(open(fpath, "rb").read()).hexdigest()
    if fsha != RESULT3_FINAL_SHA256:
        raise RuntimeError(
            f"GEN_G1 RESULT3_FINAL.json sha256 MISMATCH: {fsha[:16]}... != "
            f"pinned {RESULT3_FINAL_SHA256[:16]}... -- refusing the grade-1 "
            f"slave-slot injection (fail closed)")
    outp = os.path.join(g1dir, f"_g1_seeds_{os.getpid()}.json")
    cmd = [_sys.executable, os.path.join(g1dir, "run_g1_json.py"),
           str(g1dps), str(max(140, 2 * g1dps + 20)), outp]
    if mutate:
        cmd.append(f"--mutate={mutate}")
    r = subprocess.run(cmd, capture_output=True, text=True)
    if r.returncode != 0 or not os.path.exists(outp):
        raise RuntimeError(
            "GEN_G1 grade-1 derivation subprocess FAILED (fail closed):\n"
            + r.stdout[-600:] + r.stderr[-600:])
    res = json.load(open(outp))
    os.remove(outp)
    overlay = {}
    gate = {}
    fails = []
    need = min(110, g1dps - 13) - 5
    with mp.workdps(g1dps + 20):
        for i in G1_ALL_MASTERS:   # rev-2: all 19 derived-or-injected gate
            v = mpf(res["seeds_K1"][str(i)])
            overlay[(i, 1)] = v
            d = agree_digits(v, DATA["generic"]["boundary"][str(i)]["1"])
            gate[i] = d
            if d < need:
                fails.append((i, d))
    if fails:
        raise RuntimeError(
            f"GEN_G1 demoted-string compare gate FAILED at g1dps {g1dps}: "
            + "; ".join(f"({i},1) derived vs demoted string {d:.1f} d < "
                        f"need {need} d" for i, d in fails)
            + " [need = min(110, g1dps-13)-5, the GEN_G1 measured transport-"
            "ceiling model] -- refusing the overlay (fail closed)")
    return overlay, gate, res["wall_s"]


# ---------------------------------------------------------------------------
# The eps-graded transport (port of the validated graded local-Taylor
# closure pipeline of this work, one script per mass configuration).
# ---------------------------------------------------------------------------
def build_system(cfg, overlay):
    C = DATA[cfg]
    P = C["lead_order"]
    NM = len(C["masters"])
    state = [(i, K) for i in range(NM) for K in range(KMIN, KMAX + 1) if K >= P[i]]
    idx = {s: n for n, s in enumerate(state)}
    # state-level entries: row (i,K) <- col (j,K-k) with coefficient A^(k)_{ij}
    entries = []  # (row, col, coef_key)
    coef = {k: (v["num"], v["den"]) for k, v in C["coef"].items()}
    for key in coef:
        i, j, k = map(int, key.split(","))
        for K in range(KMIN, KMAX + 1):
            Kp = K - k
            if (i, K) in idx and (j, Kp) in idx:
                entries.append((idx[(i, K)], idx[(j, Kp)], key))
    # boundary vector at x = -1: runtime-derived/computed seeds first
    # (eq mass: all of them; generic: the 21 replaced), stored literals else
    y0 = [mpf(0)] * len(state)
    for n, (i, K) in enumerate(state):
        if (i, K) in overlay:
            y0[n] = mpf(overlay[(i, K)])   # runtime-derived (back-port fold)
        else:
            v = C["boundary"].get(str(i), {}).get(str(K))
            if v is not None:
                # HARD GUARD (rev-2, Test A): the
                # demoted grade-1 strings are held-out compare gates ONLY.
                # If any generic (i,1) key reaches this consumption site --
                # overlay dropped, future edit, any mode -- RAISE, never
                # silently consume the string as y0.
                if cfg == "generic" and (i, K) in G1_GUARDED_KEYS:
                    raise RuntimeError(
                        f"GEN_G1 HARD GUARD: demoted grade-1 string "
                        f"({i},{K}) reached build_system as a boundary "
                        f"input (overlay missing this derived-or-injected "
                        f"key). The '1' strings are held-out compare gates "
                        f"ONLY -- no string-input mode exists for K=1 "
                        f"(rev-2, no --no-g1). Fail closed.")
                y0[n] = mpf(v)             # retained interim literal (generic)
    return state, idx, entries, coef, y0, mpf(C["boundary_x"])


def taylor_step(y, x0, h, order, entries, coef, ns):
    """One local-Taylor step of y' = M(x) y:  (n+1) a_{n+1} = sum_k M_k a_{n-k}."""
    tc = {key: rat_taylor(num, den, x0, order) for key, (num, den) in coef.items()}
    hist = [[y[m]] for m in range(ns)]          # hist[m][n] = a_n[m]
    rev = [[y[m]] for m in range(ns)]           # rev[m] = hist[m] reversed
    for n in range(order):
        s = [mpf(0)] * ns
        for row, col, key in entries:
            c = tc[key]
            r = rev[col]
            s[row] += sum(ck * ak for ck, ak in zip(c, r))
        for m in range(ns):
            an1 = s[m] / (n + 1)
            hist[m].append(an1)
            rev[m].insert(0, an1)
    out = []
    for m in range(ns):
        acc, hp = mpf(0), mpf(1)
        for a in hist[m]:
            acc += a * hp
            hp *= h
        out.append(acc)
    return out


def icc_top(cfg, x_target, dps=None, order=None, verbose=False):
    """Evaluator: transport the full eps-graded ICC system from x=-1 to
    x_target (< -1/2, Euclidean axis) and return {(master, order): value}.
    This IS the analytic representation: runtime-derived boundary constants
    (eq mass; generic partial) + exact rational connection + high-order
    local-Taylor integration, all executed now.

    dps: working precision (default: gate settings).  The Taylor order scales
    proportionally so truncation keeps up with dps.  Equal-mass accuracy
    tracks dps (seeds derived at dps+25); generic accuracy floors at the
    measured recompute classes (~(BDPS-13) grade<=0, ~(g1dps-13) grade-1),
    string-capped where stored strings gate the measurement (210 d for the
    grade<=0 strings since 2026-09-06, ~110 d for the grade-1 strings)."""
    dps_def, order_def, frac = SETTINGS[cfg]
    if dps is None:
        dps = dps_def
    if order is None:
        order = max(order_def, -(-order_def * dps // dps_def))  # ceil-scale
    if not (mpf(x_target) < mpf(-1) / 2):
        raise ValueError(
            "x_target must be real and < -1/2 (Euclidean axis; the connection "
            "A(d,x) has its nearest singularity at x = -1/2); the Minkowski "
            "region x > 0 is the --minkowski X arm (the i0+ detour of the same "
            "connection), and the threshold points {0, 1, 9, r+-} are refused "
            "there by name; x = -1/2 itself is the --land arm (the circle "
            "landing) and the band -1/2 < x < -1/4 the --band X arm (the written "
            "integral beside the detour)")
    if cfg == "eqmass":
        seeds, diag, defit, dwall = eqmass_derived_seeds(dps)
        binfo = dict(kind="derived", seeds=seeds, diag=diag, defit=defit,
                     wall=dwall)
    else:
        overlay, conv, defit, swall = generic_runtime_seeds(dps)
        seeds = overlay
        if _BREC["overlay"] is not None:
            # --boundary-recompute (wiring + slot5 fix): merge the 25
            # recomputed literals; stored strings now supply NOTHING
            # ((16,0)/(18,0) computed since the 2026-07-05 solver fix).
            seeds = dict(overlay)
            seeds.update(_BREC["overlay"])
        if _G1["overlay"] is not None:
            # GEN_G1 eps^1 fold: 11 derived grade-1 seeds become the
            # value path; their strings are held-out compare gates ONLY
            seeds = dict(seeds)
            seeds.update(_G1["overlay"])
        binfo = dict(kind="partial", seeds=seeds, conv=conv, defit=defit,
                     wall=swall)
    mp.dps = dps
    state, idx, entries, coef, y, x = build_system(cfg, seeds)
    ns = len(state)
    xt = mpf(x_target)
    nstep = 0
    while x != xt:
        r = -x - mpf(1) / 2          # distance to nearest connection pole (-1/2)
        h = max(min(frac * r, fabs(xt - x)), mpf(0)) * (1 if xt > x else -1)
        if fabs(h) >= fabs(xt - x):
            h = xt - x
        y = taylor_step(y, x, h, order, entries, coef, ns)
        x += h
        nstep += 1
    if verbose:
        print(f"    [{cfg}: {ns}-component state, {len(entries)} couplings, "
              f"{nstep} Taylor steps of order {order} at dps {dps}]")
    return {s: y[n] for n, s in enumerate(state)}, binfo


def agree_digits(val, oracle_str):
    o = mpf(oracle_str)
    d = fabs(val - o)
    if d == 0:
        return float("inf")
    return float(-log10(d / fabs(o)))


def sig_digits(s):
    """Significant decimal digits carried by a stored literal string."""
    return len(re.sub(r"[-+.]", "", s.split("e")[0].split("E")[0]).lstrip("0"))


def boundary_seed_digits(cfg, dps=None):
    """Accuracy cap from the boundary block.  Equal mass: seeds are DERIVED
    at runtime at dps+25 (measured loss <= ~8 d) -> cap ~ dps+17.  Generic:
    fewest digits among the retained grade<=0 gate-cache strings (rev-2
    de-fit exclusion: K=1 excluded coherently -- the 19 grade-1 seeds are
    derived-or-injected in every mode and their strings never enter; the
    grade-1 floor enters the gate bar via the GEN_G1 g1dps-13 term
    instead)."""
    if cfg == "eqmass":
        return (dps if dps is not None else SETTINGS[cfg][0]) + 17
    return min(sig_digits(v) for i, d in DATA[cfg]["boundary"].items()
               for K, v in d.items()
               if KMIN <= int(K) <= 0 and (int(i), int(K)) not in GEN_REPLACED)


def agreement_cap(cfg, k, dps=None):
    """Measured agreement cannot exceed the shortest of: the stored oracle
    string, the boundary-seed cap, and (eq mass) the working precision."""
    cap = min(sig_digits(ORACLE[(cfg, k)]), boundary_seed_digits(cfg, dps))
    if dps is not None:
        cap = min(cap, dps + 17)
    return cap


# ---------------------------------------------------------------------------
# Boundary-block reporting (derivation diagnostics + secondary-route checks).
# ---------------------------------------------------------------------------
def print_boundary_block(cfg, binfo, spectral=True):
    """Print what the boundary block did this run: derivation diagnostics,
    forced internal gates, held-out de-fit vs the superseded oracle strings,
    and the SECONDARY relative-period cross-checks (materialized + live)."""
    if binfo["kind"] == "derived":
        diag = binfo["diag"]
        mp.dps = diag["derive_dps"]
        t11res = fabs(diag["t11"] - diag["t11_target"])
        t1res = max(fabs(a - b) for a, b in zip(diag["T1_forced"],
                                                diag["T1_forced_target"]))
        s1res = max(fabs(a - b) for a, b in zip(diag["S1_forced"],
                                                diag["S1_forced_target"]))
        print(f"    [boundary seeds DERIVED at runtime: infinity-cusp BC1/BC2 "
              f"+ grade-1 slots (icc_blib);")
        print(f"     derive dps {diag['derive_dps']}, series N {diag['nser']}, "
              f"{diag['nstep']} steps of order {diag['order']}; "
              f"wall {binfo['wall']:.1f} s]")
        print(f"      forced internal gates: |t11 - 2*Tri0| = "
              f"{mp.nstr(t11res, 3)}; T1 bracket = {mp.nstr(t1res, 3)}; "
              f"S1 (3,-6g) = {mp.nstr(s1res, 3)}")
        print(f"      derived seeds vs superseded oracle strings "
              f"(held out, excl (6,1)): min {binfo['defit']:.1f} d")
        if diag.get("top_defit"):
            print("      top master T(-1) eps^"
                  + "/".join(str(K) for K, _, _ in diag["top_defit"])
                  + " vs its stored x=-1 strings ("
                  + "/".join(str(n) for _, n, _ in diag["top_defit"])
                  + " d): "
                  + " / ".join(f"{d:.1f}" for _, _, d in diag["top_defit"])
                  + " d")
        # SECONDARY route: materialized relative-period integrals (vendored
        # cross-check values, icc-derived.json) + live spectral evaluation
        pl = DERIVED["period_lane"]
        T_m1 = binfo["seeds"][(4, 0)]
        f41 = binfo["seeds"][(4, 1)]
        print(f"      T(-1) vs materialized relative-period integral "
              f"({pl['row15_T_eq_eps0']['agreement_digits']} d, relative-period route): "
              f"{blib.agree_digits(T_m1, pl['row15_T_eq_eps0']['value_284d']):.1f} d")
        print(f"      T^(1)(-1) vs materialized eps^1 period integral "
              f"({pl['row17_f41_eq_eps1']['agreement_digits']} d): "
              f"{blib.agree_digits(f41, pl['row17_f41_eq_eps1']['value_133d']):.1f} d")
        if spectral:
            t0 = time.time()
            plive = blib.period_T_eps0((1, 1, 1, 1), dps=15)
            print(f"      T(-1) vs LIVE spectral integral (dps 15, computed "
                  f"now): {blib.agree_digits(T_m1, mp.nstr(plive, 40)):.1f} d "
                  f"[{time.time() - t0:.1f} s]")
    else:
        nrepl = len(binfo["seeds"])
        if _BREC["overlay"] is not None:
            ncache_ok = sum(1 for c in _BREC["cache"] if c[3])
            dmin = min(c[2] for c in _BREC["cache"])
            print(f"    [--boundary-recompute {_BREC['bdps']}: "
                  f"{len(_BREC['overlay'])} retained literals (ALL) "
                  f"RECOMPUTED at runtime [{_BREC['wall']:.0f} s] "
                  f"(recompute wiring + slot5 fix, production 25/25);")
            print(f"     demoted-string cache check: {ncache_ok}/"
                  f"{len(_BREC['cache'])} within resolution "
                  f"(min {dmin:.1f} d at bdps {_BREC['bdps']});")
            # 2026-09-06: the top master's own entry of that check, printed
            # beside the min (the T(-1) cell; its x=-1 string carries 210 d)
            top_i = DATA[cfg]["top_index"]
            top_c = [c for c in _BREC["cache"] if (c[0], c[1]) == (top_i, 0)]
            if top_c:
                print(f"     top master T(-1) eps^0 recomputed vs its stored "
                      f"x=-1 string ({sig_digits(DATA[cfg]['boundary'][str(top_i)]['0'])} d): "
                      f"{top_c[0][2]:.1f} d;")
            print(f"     (16,0),(18,0) FIXED 2026-07-05, now computed: the "
                  f"former OPEN u^(1/2) defect was a solver bug (E_F forward "
                  f"reference, level-(n+1) T-terms dropped; fifth dof = 0 -- "
                  f"two-pass fix, icc_slot5/RESULT.md)]")
        print(f"    [boundary block PARTIAL runtime (row-16 fold): {nrepl} of "
              f"stored seed literals replaced at runtime (grade<=0 baseline 46; grade-1 overlay counted when active) "
              f"[{binfo['wall']:.1f} s];")
        # stored-strings-as-inputs count: 65 stored generic literals - 21
        # runtime-derived - (25 recomputed in recompute mode, slot5 fix) - (19
        # grade-1 derived-or-injected when the GEN_G1 fold is active, rev-2).
        # Default = 0 (strings supply nothing); --cached = 25 (grade<=0 only).
        nret = (44
                - (len(_BREC["overlay"]) if _BREC["overlay"] is not None
                   else 0)
                - (len(_G1["overlay"]) if _G1["overlay"] is not None else 0))
        print(f"     tadpole^2/triangle closed forms + LIVE scooplib spectral "
              f"S/S14; {nret} stored strings fed as inputs this run"
              f"{' (grade<=0 gate-cache, --cached)' if nret else ''}]")
        print(f"      replaced seeds vs superseded oracle strings (held out): "
              f"min {binfo['defit']:.1f} d")
        print(f"      scooplib maxdegree-convergence self-check: "
              f"{binfo['conv']:.1f} d")
        if spectral:
            t15 = DATA["generic"]["boundary"]["15"]["0"]
            t0 = time.time()
            plive = blib.period_T_eps0(tuple(DATA["generic"]["masses_sq"]),
                                       dps=15)
            mp.dps = 60
            print(f"      retained T(-1) literal vs LIVE spectral integral "
                  f"(dps 15): {blib.agree_digits(plive, t15):.1f} d "
                  f"[{time.time() - t0:.1f} s; analytic boundary-route gate "
                  f"{DERIVED['period_lane']['row16_boundary_lane_gate_d']} d "
                  f"< stored {sig_digits(t15)} d -> literal retained]")


# ---------------------------------------------------------------------------
# Demo modes.  Default: evaluate at the held-out gate point and compare
# against the stored AMFlow oracles.  --point/--dps: evaluate elsewhere.
# --double: dps-doubling demo on the eq-mass gate point.
# ---------------------------------------------------------------------------
CONFIG_LABEL = {"eqmass": "equal mass m^2=(1,1,1,1)",
                "generic": "generic mass m^2=(1,2,3,5)"}
SCOOP_MSQ = {"eqmass": (1, 1, 1), "generic": (1, 3, 5)}


def scoop_bessel_check(cfg, x, scoop_transport):
    """Cross-method check: transported scoop (= sunrise, d=2) vs a live
    Bessel-moment quadrature — two independent runtime computations."""
    print()
    print("=" * 78)
    print(f"Cross-method scoop check at x={x} (two independent runtime computations)")
    print("=" * 78)
    mp.dps = 40
    Pm = sqrt(-mpf(x))
    ms = [sqrt(mpf(m)) for m in SCOOP_MSQ[cfg]]
    bessel = -4 * quad(lambda t: t * besselj(0, Pm * t) * besselk(0, ms[0] * t)
                       * besselk(0, ms[1] * t) * besselk(0, ms[2] * t),
                       [0, 1, 5, 20, 60, 120])
    d = agree_digits(scoop_transport, str(bessel))
    print(f"  scoop eps^0, DE-transport      : {mp.nstr(scoop_transport, 35)}")
    print(f"  scoop eps^0, Bessel quadrature : {mp.nstr(bessel, 35)}")
    print(f"  agreement (recomputed)         : {min(d, mp.dps - 5):.1f} d")


def run_gate(configs, dps=None):
    """Gate demo at the held-out point X_TARGET with live oracle comparison."""
    print("=" * 78)
    print(f"ICC top master by runtime eps-graded DE-transport, x=-1 -> x={X_TARGET}")
    if _BREC["overlay"] is not None:
        print("(boundary constants DERIVED/RECOMPUTED at runtime: eq mass "
              "fully, generic")
        print(" 46/46 grade<=0 [21 runtime-derived + 25 recomputed, default "
              "since 2026-07-06]")
        print(" + 19/19 grade-1 eps^1 derived-or-injected [GEN_G1 fold rev-2:"
              " 11 derived + 8")
        print(" injected from the sha-pinned NEPS=4 FINAL RESULT3_FINAL.json;"
              " reference-")
        print(" exhausted 19/19])")
    else:
        # NOTE: keep this legacy line byte-identical (eq-mass-only default
        # runs print it; downstream checks compare it byte-for-byte)
        print("(boundary constants DERIVED at runtime: eq mass fully, "
              "generic 21/46)")
        if _G1["overlay"] is not None:   # --cached generic: G1 still active
            print(" [--cached covers grade<=0 only: grade-1 eps^1 19/19 "
                  "derived-or-injected (GEN_G1 rev-2)]")
    print("=" * 78)
    scoop_transport = None
    for cfg in configs:
        t0 = time.time()
        top_i = DATA[cfg]["top_index"]
        vals, binfo = icc_top(cfg, X_TARGET, dps=dps, verbose=True)
        dt = time.time() - t0
        cfg_dps = dps if dps is not None else SETTINGS[cfg][0]
        print_boundary_block(cfg, binfo)
        mp.dps = cfg_dps
        if cfg == "eqmass":
            scoop_transport = vals[(DATA[cfg]["scoop_index"], 0)]
        for k in (0, 1):
            v = vals[(top_i, k)]
            d = agree_digits(v, ORACLE[(cfg, k)])
            cap = agreement_cap(cfg, k, cfg_dps)
            print(f"\n  {CONFIG_LABEL[cfg]}, TOP eps^{k} at x={X_TARGET} (held out)")
            print(f"    this work (computed now): {mp.nstr(v, 50)}")
            print(f"    AMFlow oracle (stored)  : {ORACLE[(cfg, k)][:52]}...")
            print(f"    agreement (recomputed)  : {d:.1f} d")
            if d >= cap - 3:
                print(f"    [agreement CAPPED at ~{cap} d = min(stored oracle "
                      f"string {sig_digits(ORACLE[(cfg, k)])} d, boundary cap "
                      f"{boundary_seed_digits(cfg, cfg_dps)} d, dps)]")
            # 2026-07-05 rc-failclosed sweep (charter v2 clause 4): the
            # agreement lines above were print-only (rc=0 below any bar).
            # Bar = the cap this table already prints, dps-tracked, minus a
            # 6 d guard; in --boundary-recompute mode the generic boundary
            # floors at the measured recompute class ~(BDPS - 13) d.
            gate_bar = min(cfg_dps, cap) - 6
            brec_note = ""
            if cfg == "generic" and _BREC["overlay"] is not None:
                gate_bar = min(gate_bar, _BREC["bdps"] - 13)
                brec_note = f"; recompute floor class BDPS {_BREC['bdps']} - 13"
            if cfg == "generic" and k == 1 and _G1["overlay"] is not None:
                gate_bar = min(gate_bar, _G1["dps"] - 13 - 6)
                brec_note += f"; GEN_G1 fold floor g1dps {_G1['dps']} - 13"
            print(f"    [gate] bar {gate_bar:.1f} d (min(dps, printed cap) - 6"
                  f"{brec_note}); below-bar RAISES (rc!=0)")
            if not (d >= gate_bar):
                raise RuntimeError(
                    f"ICC {cfg} TOP eps^{k} held-out gate FAIL (below bar => "
                    f"nonzero exit): {d:.1f} d < bar {gate_bar:.1f} d "
                    f"(dps {cfg_dps}, cap {cap} d)")
            if (cfg, k) in ORACLE_VERIFY:
                dv = agree_digits(v, ORACLE_VERIFY[(cfg, k)])
                print(f"    vs independent verify-harness oracle: {dv:.1f} d")
                bar_v = min(gate_bar,
                            sig_digits(ORACLE_VERIFY[(cfg, k)]) - 11)
                if not (dv >= bar_v):
                    raise RuntimeError(
                        f"ICC {cfg} TOP eps^{k} verify-harness gate FAIL "
                        f"(below bar => nonzero exit): {dv:.1f} d < bar "
                        f"{bar_v:.1f} d (dps {cfg_dps})")
        print(f"    [total wall this config: {dt:.1f} s]")
    if scoop_transport is not None:
        scoop_bessel_check("eqmass", X_TARGET, scoop_transport)


def run_point(configs, x, dps=None):
    """Evaluate at a caller-chosen Euclidean point x < -1/2.  No stored
    oracle exists off the gate point, so values are printed as computed;
    the eq-mass scoop still gets the live Bessel cross-check."""
    print("=" * 78)
    print(f"ICC masters by runtime eps-graded DE-transport, x=-1 -> x={x}")
    if _XM3["strings"] is not None:
        print(f"(x={x}: the vendored AMFlow oracle {ORACLE_XM3['file']} gates the")
        print(" generic top master below (string-capped); boundary constants are")
        print(" derived at runtime and the scoop is Bessel cross-checked below)")
    else:
        print("(user-chosen point: no stored oracle here; boundary constants are")
        print(" derived at runtime and the scoop is Bessel cross-checked below)")
    print("=" * 78)
    scoop_transport = None
    for cfg in configs:
        t0 = time.time()
        top_i = DATA[cfg]["top_index"]
        vals, binfo = icc_top(cfg, x, dps=dps, verbose=True)
        dt = time.time() - t0
        cfg_dps = dps if dps is not None else SETTINGS[cfg][0]
        print_boundary_block(cfg, binfo)
        mp.dps = cfg_dps
        if cfg == "eqmass":
            scoop_transport = vals[(DATA[cfg]["scoop_index"], 0)]
        lead = DATA[cfg]["lead_order"][top_i]
        print(f"\n  {CONFIG_LABEL[cfg]}, TOP master at x={x}:")
        for k in range(max(lead, KMIN), KMAX + 1):
            print(f"    eps^{k:+d}: {mp.nstr(vals[(top_i, k)], 50)}")
        print(f"    [accuracy cap: "
              f"~{boundary_seed_digits(cfg, cfg_dps)} d "
              f"({'runtime-derived seeds' if cfg == 'eqmass' else 'grade<=0 gate-cache strings; grade-1 derived-or-injected'})]")
        if (cfg == ORACLE_XM3["config"] and _XM3["strings"] is not None
                and mpf(x) == mpf(ORACLE_XM3["x"])):
            gate_xm3(cfg, x, vals, top_i, cfg_dps)
        print(f"    [total wall this config: {dt:.1f} s]")
    if scoop_transport is not None:
        scoop_bessel_check("eqmass", x, scoop_transport)


def run_double():
    """dps-doubling demo: same gate point, default dps then 2x dps.  The
    live agreement grows until the stored-oracle-string cap.  The boundary
    derivation runs ONCE at the deeper depth and is reused for both runs."""
    cfg = "eqmass"
    dps_def = SETTINGS[cfg][0]
    print("=" * 78)
    print(f"dps-doubling demo: {CONFIG_LABEL[cfg]} gate point x={X_TARGET}, "
          f"dps {dps_def} then {2 * dps_def}")
    print(f"(single boundary derivation at depth {2 * dps_def + 25}, reused; "
          f"expect a long wall)")
    print("=" * 78)
    deep = eqmass_derived_seeds(2 * dps_def)
    _SEED_CACHE[("eqmass", dps_def)] = deep    # reuse deep seeds for both runs
    print_boundary_block(cfg, dict(kind="derived", seeds=deep[0], diag=deep[1],
                                   defit=deep[2], wall=deep[3]))
    top_i = DATA[cfg]["top_index"]
    for dps in (dps_def, 2 * dps_def):
        t0 = time.time()
        vals, _ = icc_top(cfg, X_TARGET, dps=dps, verbose=True)
        dt = time.time() - t0
        mp.dps = dps
        for k in (0, 1):
            d = agree_digits(vals[(top_i, k)], ORACLE[(cfg, k)])
            cap = min(sig_digits(ORACLE[(cfg, k)]), 2 * dps_def + 17)
            capped = "  <- CAPPED by stored oracle string" if d >= cap - 3 else ""
            print(f"    dps={dps:4d}  TOP eps^{k}: agreement (recomputed) = "
                  f"{d:.1f} d{capped}")
        print(f"    [transport wall time: {dt:.1f} s]")
    print(f"\n  Cap: oracle strings carry {sig_digits(ORACLE[(cfg, 0)])}/"
          f"{sig_digits(ORACLE[(cfg, 1)])} d (eps^0/eps^1); the boundary seeds")
    caps = [min(sig_digits(ORACLE[(cfg, k)]), 2 * dps_def + 17) for k in (0, 1)]
    print(f"  are derived at runtime at depth {2 * dps_def + 25} — measured "
          f"agreement cannot exceed min(string, 2*dps + 17) = {caps[0]}/{caps[1]} d.")
    print("  The evaluator is arbitrary-precision end-to-end: digits grew with")
    if all(caps[k] < sig_digits(ORACLE[(cfg, k)]) for k in (0, 1)):
        print("  dps; at this depth the working precision, not the stored strings,")
        print("  is the cap (raise --dps and the strings still have digits left).")
    else:
        print("  dps until the stored comparison strings ran out, not before.")


# ---------------------------------------------------------------------------
# GENERIC-MASS FOLD (2026-07-06, computed in this work).
# The connection is generic-mass (ADMITTED
# A_symbolic.json); this block makes the script ACCEPT arbitrary masses.
# ---------------------------------------------------------------------------
def _genmass_seeds(m2v, m3v, m4v, dps, mutate=None):
    """Covariant boundary classes at exact squared masses (m1^2 = 1), DERIVED
    at runtime -- the generic-mass generalization of runtime_seeds():
      tadpole^2 masters {0: m3, 1: m2*m3, 3: m4, 4: m3*m4, 9: m2*m4}:
          Gamma(eps)^2 P^-eps closed forms, K=-2..0;
      triangle masters {2: m4->m3 tad}, {10: m4 tad}: bubble(1, m2) at
          p56^2 = -1, kernel Q(a) = m2 + a*(2-m2) - a^2 (== 2-a^2 at the
          reference m2=2), W = Int da/Q, I1 = -Int ln(Q)/Q (certified
          quadratures); (i,-1) = -W, (i,0) = (2g + ln P)*W - I1;
      sunrise masters {5: (1,m3,m4), 11: (m2,m3,m4)}: LIVE materialized
          spectral integral Scoop(...).S0(-1), raising mdeg gate.
    Returns (overlay {(i,K): mpf}, W, conv_digits).
    REFUSED (fail-closed) grades are NOT in the overlay: top/slave/dotted
    masters {6,7,8,12,13,14,15,16,17,18} -- their grade<=0 cusp-solve
    boundary machinery is reference-(2,3,5)-bound (icc_layers_generic
    closed_forms_srepr + icc_slots_result slot ring; GEN_G1_RESULT.md sec 7)."""
    from fractions import Fraction as _F
    mp.dps = dps + 40
    g = +euler
    z2 = pi ** 2 / 6
    q = lambda fr: mpf(fr.numerator) / mpf(fr.denominator)
    m2q, m3q, m4q = q(m2v), q(m3v), q(m4v)
    out = {}
    for i, P in ((0, m3q), (1, m2q * m3q), (3, m4q), (4, m3q * m4q),
                 (9, m2q * m4q)):
        lP = log(P)
        out[(i, -2)] = mpf(1)
        out[(i, -1)] = -(2 * g + lP)
        out[(i, 0)] = 2 * g * g + z2 + 2 * g * lP + lP * lP / 2
    # triangle bubble kernel Q(a) = m2 + a*(2-m2) - a^2 (p56^2 = -1, masses
    # (1, m2)); degenerate guard: Q must be positive on [0,1]
    Qk = lambda a: m2q + a * (2 - m2q) - a * a
    for aa in (mpf(0), mpf(1) / 4, mpf(1) / 2, mpf(3) / 4, mpf(1)):
        if Qk(aa) <= 0:
            raise gml.GenMassError(
                f"triangle bubble kernel Q(a) = m2 + a(2-m2) - a^2 "
                f"non-positive on [0,1] at m2 = {m2v} (threshold/degenerate "
                f"mass point; the Euclidean quadrature rep fails) -- REFUSED "
                f"fail closed")
    _w, _ = blib.quad_certified(lambda a: 1 / Qk(a), [0, 1], dps + I1_GUARD,
                                name="genmass triangle W quadrature")
    _i1, _ = blib.quad_certified(lambda a: log(Qk(a)) / Qk(a), [0, 1],
                                 dps + I1_GUARD,
                                 name="genmass triangle I1 quadrature")
    W = _w
    I1 = -_i1
    for i, P in ((2, m3q), (10, m4q)):
        out[(i, -1)] = -W
        out[(i, 0)] = (2 * g + log(P)) * W - I1
    # sunrises: LIVE spectral integrals at the requested masses
    mp.dps = dps + 30
    mdeg = 10 + max(0, (dps - 90) // 60)
    conv = float("inf")
    tol = mpf(10) ** (-(dps + SCOOP_GUARD))
    for i, cfg in ((5, (_F(1), m3v, m4v)), (11, (m2v, m3v, m4v))):
        s = Scoop(*(q(_F(c)) for c in cfg))
        m = mdeg
        v = s.S0(mpf(-1), maxdegree=m)
        v2 = s.S0(mpf(-1), maxdegree=m + 1)
        d = fabs(v - v2)
        while d != 0 and d / fabs(v2) >= tol:
            if m >= mdeg + SCOOP_MDEG_CAP_ADD:
                raise RuntimeError(
                    f"genmass scoop seed gate FAILED: sunrise {cfg} "
                    f"mdeg/mdeg+1 agreement >= tol at maxdegree {m}/{m+1} "
                    f"-- refusing to seed (fail closed)")
            m += 1
            v = v2
            v2 = s.S0(mpf(-1), maxdegree=m + 1)
            d = fabs(v - v2)
        out[(i, 0)] = v2
        conv = min(conv, float("inf") if d == 0 else
                   float(-log10(d / fabs(v2))))
    if mutate == "scoop":
        out[(5, 0)] += mpf(10) ** (-30)
        print("  [NEGATIVE CONTROL] S scoop seed (5,0) += 1e-30 -- the "
              "S(x) dual-quadrature gate MUST now fail (rc!=0)")
    mp.dps = dps
    return out, W, conv


# ---------------------------------------------------------------------------
# THE OFF-SLICE (X, Y) ARM (2026-09-06): the nine-master transport along the
# exact two-variable connection (A_x, A_y)(eps, x, y) at w = -1 vendored under
# vendor_rows1517_offslice/xy/ (every file the arm reads sha256-pinned in
# OFFSLICE_PINS), from the seed of record at (-3, -4) -- the served
# vendor_rows1517_offslice/line_m3/seed_e5.json, reused by pin -- to a point
# (X, Y) of the Euclidean region, and, at the three reference points, the gate
# against the vendored AMFlow values (bar 30).  The engine and the gate run as
# subprocesses (xy/transport_xy.py, xy/compare_xy.py); no AMFlow call at run
# time.  See THE OFF-SLICE (X, Y) ARM in the docstring.
# ---------------------------------------------------------------------------
OFFSLICE_XY = "vendor_rows1517_offslice/xy"
OFFSLICE_PINS = {   # script-emitted from the shipped bytes: sha256 of every file the arm reads
    "vendor_rows1517_offslice/amf_result.py": "3064ec57183ee85ac730b93713d157c5ade22869b3ba4daaa949a45692ef641f",
    "vendor_rows1517_offslice/line_m3/seed_e5.json": "0294999af45e2a9e73374ea74535dc058218f0e35530630b7e70a40767a760c5",
    "vendor_rows1517_offslice/xy/A_point.json": "d55a29d8d37a204d18ef53d80a4719ef0b4996e4d4bfc456efc217003a2d525f",
    "vendor_rows1517_offslice/xy/A_xy_eps_monomial.json": "5c7f56a3538bae628541e4ee1045419b40465f2abc3ed2306c77153204f8d4fc",
    "vendor_rows1517_offslice/xy/PAe5_g40.json": "afd2a65f82187e1d7457975d0f39570a2554b40c9a531b215d6e2b475def8773",
    "vendor_rows1517_offslice/xy/PAe5_g60.json": "7b54163a50c562278c06b291804184b8d8a0b489f1f192755d7b0e4f0e8db4dc",
    "vendor_rows1517_offslice/xy/PBe5_g40.json": "f865278922a6652075c56ba33d9a953f6c2f478ce7784905e23aa9c6a348b413",
    "vendor_rows1517_offslice/xy/PBe5_g60.json": "6e6f439bec9d8d4a3e13588a61c0cbfb074d543953eed6e338406ae686c29d83",
    "vendor_rows1517_offslice/xy/PMe5_g40.json": "f16bc9d837d2528cb617fafdf394612ef11003b7e2271f68d283d08de726a405",
    "vendor_rows1517_offslice/xy/README.md": "be5e75656992305ee5c1ef8fb76e8bba75d66c014a5dcbb6e9411fb11006b6e6",
    "vendor_rows1517_offslice/xy/S34e5_g60.json": "480e097b786403b1251adb5bd38f82cb08f3a97ca8b9e8d7c7844901577e97e0",
    "vendor_rows1517_offslice/xy/XY_MANIFEST.sha256": "aa6ef4d9e9e45b78edef50b05d5e409e6bdacd799ea3df25b8d93a1d40e58f57",
    "vendor_rows1517_offslice/xy/compare_xy.py": "904859271bdf605c86890613510400005c0ee35321723614ea540cba42827069",
    "vendor_rows1517_offslice/xy/transport_xy.py": "e33972cc5e556b1d770aebbe8a365073fdb185f0d2826dffe416f3798225154e",
}
# --- END OFFSLICE_PINS ---
OFFSLICE_SEED = {"file": "vendor_rows1517_offslice/line_m3/seed_e5.json", "point": ("-3", "-4"), "goal": 40,
                 "label": "the seed of record at (-3, -4) (AMFlow goal 40, eps_order 5; the served line_m3/seed_e5.json)"}
OFFSLICE_SEED_TWIN = {"file": "vendor_rows1517_offslice/xy/S34e5_g60.json", "point": ("-3", "-4"), "goal": 60,
                      "label": "the goal-60 twin of the seed at (-3, -4) (AMFlow goal 60, eps_order 5; xy/S34e5_g60.json)"}
# the three reference points: the vendored AMFlow values (eps_order 5, eps^-2..eps^1; gate only) and the record's floors
# (script-emitted from the receipt of record at build time; every figure a floor of a two-string agreement)
OFFSLICE_REFERENCES = {'PA': {'point': ['-3', '-15/4'],
        'files': {'goal 40': 'vendor_rows1517_offslice/xy/PAe5_g40.json', 'goal 60': 'vendor_rows1517_offslice/xy/PAe5_g60.json'},
        'record': {'goal 40': {'floor': 48,
                               'worst_d': 48.12,
                               'member_master': [1, 1, 1, 1, -2, 0, 0],
                               'member_order': 1,
                               'per_order_min': {'-2': 65.0, '-1': 63.65, '0': 55.24, '1': 48.12},
                               'n_rows': 27},
                   'goal 60': {'floor': 47,
                               'worst_d': 47.78,
                               'member_master': [-2, 1, 1, 1, 0, 0, 0],
                               'member_order': 1,
                               'per_order_min': {'-2': 65.0, '-1': 63.05, '0': 55.08, '1': 47.78},
                               'n_rows': 27}},
        'seed_twin_record': {'floor': 47, 'worst_d': 47.78},
        'pair_45_60_record': {'floor': 49, 'worst_d': 49.39},
        'amflow_twins_record': {'floor': 47, 'worst_d': 47.78}},
 'PB': {'point': ['-5/2', '-15/4'],
        'files': {'goal 40': 'vendor_rows1517_offslice/xy/PBe5_g40.json', 'goal 60': 'vendor_rows1517_offslice/xy/PBe5_g60.json'},
        'record': {'goal 40': {'floor': 47,
                               'worst_d': 47.94,
                               'member_master': [1, 1, 1, 1, -2, 0, 0],
                               'member_order': 1,
                               'per_order_min': {'-2': 65.0, '-1': 63.17, '0': 55.7, '1': 47.94},
                               'n_rows': 27},
                   'goal 60': {'floor': 47,
                               'worst_d': 47.94,
                               'member_master': [1, 1, 1, 1, -2, 0, 0],
                               'member_order': 1,
                               'per_order_min': {'-2': 65.0, '-1': 62.86, '0': 54.91, '1': 47.94},
                               'n_rows': 27}},
        'seed_twin_record': {'floor': 47, 'worst_d': 47.94},
        'pair_45_60_record': {'floor': 49, 'worst_d': 49.32},
        'amflow_twins_record': {'floor': 48, 'worst_d': 48.12}},
 'PM': {'point': ['-15/4', '-5/2'],
        'files': {'goal 40': 'vendor_rows1517_offslice/xy/PMe5_g40.json'},
        'record': {'goal 40': {'floor': 47,
                               'worst_d': 47.86,
                               'member_master': [1, -2, 1, 1, 0, 0, 0],
                               'member_order': 1,
                               'per_order_min': {'-2': 65.0, '-1': 62.8, '0': 55.37, '1': 47.86},
                               'n_rows': 27}},
        'seed_twin_record': {'floor': 47, 'worst_d': 47.97},
        'pair_45_60_record': {'floor': 49, 'worst_d': 49.39},
        'amflow_twins_record': None}}
OFFSLICE_BAR = 30.0     # the two-precision bar on every (master, order) pair
OFFSLICE_TOP = [1, 1, 1, 1, 0, 0, 0]   # the top master (the --mutate control perturbs its eps^0 reference string)
OFFSLICE_RC = {"fail": 1, "refused": 2, "pin_mismatch": 3, "missing": 4, "engine": 5, "not_caught": 6}
OFFSLICE_DETOUR = ("-1/4", "1/4")      # the complex displacement (x, y) of a crossing chord's midpoint off x = y


def offslice_die(rc, msg):
    print(msg, flush=True)
    raise SystemExit(rc)


def offslice_check_pins():
    """every file the arm reads, hashed BEFORE any computation: a file missing -> exit 4, a byte changed -> exit 3, by name."""
    import hashlib
    for rel, want in OFFSLICE_PINS.items():
        p = os.path.join(HERE, rel)
        if not os.path.exists(p):
            offslice_die(OFFSLICE_RC["missing"],
                         f"icc-evaluate MISSING: pinned file {rel} is absent beside this file (recorded sha256 {want}); "
                         f"not serving --offslice")
        got = hashlib.sha256(open(p, "rb").read()).hexdigest()
        if got != want:
            pos = next(i + 1 for i in range(64) if got[i] != want[i])
            offslice_die(OFFSLICE_RC["pin_mismatch"],
                         f"icc-evaluate REFUSED: {rel} integrity pin mismatch (recorded {want}, recomputed {got}; "
                         f"first differing hex position {pos} of 64, 1-based) -- the shipped file was altered; "
                         f"not serving --offslice")
    return len(OFFSLICE_PINS)


def offslice_factor_value(expr, X, Y):
    """a census factor (an integer polynomial in x, y as A_point.json prints it) evaluated EXACTLY at rational (X, Y):
    the expression is checked to be digits, x, y, +, -, *, ** and spaces, then evaluated over Fractions."""
    if not re.fullmatch(r"[0-9xy+\-* ]*", expr):
        raise ValueError(f"not a census polynomial: {expr!r}")
    return eval(expr, {"__builtins__": {}}, {"x": X, "y": Y})


def offslice_refuse(X, Y, factors):
    """the named refusals (exit 2), before any computation: the slice X = Y (the nine-master basis degenerates there: no
    value ON the slice from this arm); outside the Euclidean region; a zero of a denominator factor of the connection
    at d = 2 (the census of xy/A_point.json, evaluated exactly at (X, Y))."""
    if X == Y:
        offslice_die(OFFSLICE_RC["refused"],
                     f"icc-evaluate REFUSED: (X, Y) = ({X}, {Y}) lies ON the symmetric slice p12^2 = p34^2, where the nine-master "
                     f"off-slice basis degenerates to the slice's seven masters; this arm gives no value there (the default "
                     f"tiers evaluate the slice: --point {X})")
    if not (X < 0 and Y < 0):
        offslice_die(OFFSLICE_RC["refused"],
                     f"icc-evaluate REFUSED: (X, Y) = ({X}, {Y}) is outside the Euclidean region X < 0, Y < 0 (p56^2 = -1, "
                     f"m^2 = 1): the transport along real segments is defined there only")
    for f in factors:
        if offslice_factor_value(f, X, Y) == 0:
            offslice_die(OFFSLICE_RC["refused"],
                         f"icc-evaluate REFUSED: (X, Y) = ({X}, {Y}) is a zero of the denominator factor '{f}' of the "
                         f"connection at d = 2 (a singular point of the nine-master system; the census of xy/A_point.json)")


def offslice_census_on_segment(Pq, Qq, factors):
    """the census factors restricted to the REAL segment P -> Q (x = xa + t dx, y = ya + t dy, t in [0, 1]): each is a
    polynomial in t of degree <= 2 with rational coefficients (a t^2 + b t + c from its exact values at t = 0, 1/2, 1);
    returns the factors with a real zero on the closed segment, decided EXACTLY (a sign change over [0, 1], or a
    vertex inside [0, 1] with the discriminant >= 0)."""
    from fractions import Fraction as _F
    hits = []
    for f in factors:
        def at(t):
            return offslice_factor_value(f, Pq[0] + t * (Qq[0] - Pq[0]), Pq[1] + t * (Qq[1] - Pq[1]))
        f0, fh, f1 = at(_F(0)), at(_F(1, 2)), at(_F(1))
        a = 2 * (f1 + f0 - 2 * fh)
        b = f1 - f0 - a
        c = f0
        if f0 == 0 or f1 == 0 or f0 * f1 < 0:
            hits.append(f)
            continue
        if a != 0:
            tv = -b / (2 * a)                       # the vertex; f(tv) = c - b^2 / (4 a)
            if 0 < tv < 1 and (c - b * b / (4 * a)) * f0 <= 0:
                hits.append(f)
    return hits


def offslice_route(X, Y, factors):
    """the route from the seed (-3, -4) to (X, Y) as straight segments: the p12^2 = -3 leg (-3, -4) -> (-3, Y), then the
    p34^2 = Y leg (-3, Y) -> (X, Y); the other order, (-3, -4) -> (X, -4) -> (X, Y), and the direct chord are the
    alternatives.  A segment whose chord crosses the apparent diagonal x = y is replaced by the detour P -> W -> Q,
    W = the chord's midpoint displaced by (-i/4, +i/4) off x = y (the record's detour; the physical solution is
    analytic on the diagonal, so either side gives the same values).  A real segment on which a census factor
    vanishes (checked exactly, offslice_census_on_segment) is never taken: the first of the three candidates whose
    real segments are free of census zeros is chosen, one without a diagonal crossing preferred; when all three
    meet a singular curve the point is REFUSED by name (exit 2) -- this arm does not steer around the census curves.
    Corners on the diagonal are never used.  Zero-length segments are dropped.  Returns (the waypoint list, a text,
    the number of detours)."""
    from fractions import Fraction as _F
    S = (_F(OFFSLICE_SEED["point"][0]), _F(OFFSLICE_SEED["point"][1]))
    dx, dy = _F(OFFSLICE_DETOUR[0]), _F(OFFSLICE_DETOUR[1])

    def crosses(Pq, Qq):
        s0, s1 = Pq[0] - Pq[1], Qq[0] - Qq[1]
        return s0 * s1 < 0

    cands = []
    if S[0] != Y:
        cands.append([S, (S[0], Y), (X, Y)])
    if X != S[1]:
        cands.append([S, (X, S[1]), (X, Y)])
    cands.append([S, (X, Y)])
    graded = []
    for o in cands:
        legs = [(o[i], o[i + 1]) for i in range(len(o) - 1) if o[i] != o[i + 1]]
        real_hits = [(p, q, h) for p, q in legs if not crosses(p, q) for h in offslice_census_on_segment(p, q, factors)]
        chord_hits = [(p, q, h) for p, q in legs if crosses(p, q) for h in offslice_census_on_segment(p, q, factors)]
        # a crossing chord is replaced by its detour (two complex segments): a census zero on the real chord is then
        # off the path, counted only to prefer a route without one
        ncross = sum(1 for p, q in legs if crosses(p, q))
        graded.append((len(real_hits) > 0, ncross, len(chord_hits), o, legs, real_hits))
    clean = [g for g in graded if not g[0]]
    if not clean:
        first = graded[0]
        p, q, h = first[5][0]
        offslice_die(OFFSLICE_RC["refused"],
                     f"icc-evaluate REFUSED: no straight-segment route from (-3, -4) reaches ({X}, {Y}) without meeting a singular "
                     f"curve of the connection: on the segment ({p[0]}, {p[1]}) -> ({q[0]}, {q[1]}) the census factor '{h}' "
                     f"vanishes (the other segment order and the direct chord meet one too; checked exactly); this arm does "
                     f"not steer around the census curves")
    clean.sort(key=lambda g: (g[1], g[2]))
    _, ncross, _, o, legs, _ = clean[0]
    way = []
    txt = []
    for k, (p, q) in enumerate(legs):
        last = (q == (X, Y))
        if crosses(p, q):
            mx, my = (p[0] + q[0]) / 2, (p[1] + q[1]) / 2
            way.append({"name": f"W{k + 1}", "x": [str(mx), str(dx)], "y": [str(my), str(dy)], "report": False})
            sx, sy = ("+" if dx >= 0 else "-") + str(abs(dx)), ("+" if dy >= 0 else "-") + str(abs(dy))
            txt.append(f"-> W{k + 1} = ({mx} {sx} i, {my} {sy} i) [the detour off x = y] -> ({q[0]}, {q[1]})")
        else:
            txt.append(f"-> ({q[0]}, {q[1]})")
        way.append({"name": "TARGET" if last else f"C{k + 1}", "x": [str(q[0]), "0"], "y": [str(q[1]), "0"], "report": last})
    return way, " ".join(txt), ncross


def offslice_reference_at(X, Y):
    for tag, ref in OFFSLICE_REFERENCES.items():
        from fractions import Fraction as _F
        if (_F(ref["point"][0]), _F(ref["point"][1])) == (X, Y):
            return tag, ref
    return None, None


def offslice_mutate_reference(src, dst):
    """NEGATIVE CONTROL: a copy of the goal-40 reference with the eps^0 midpoint string of the top master perturbed at its
    20th significant digit ((digit + 1) mod 10; the AMFlow ball string '[mid +/- rad]' keeps its form); the file and its
    pin untouched.  Returns (the digit before, the digit after)."""
    d = json.load(open(src))
    hit = None
    for r in d["result"]:
        if r["integral"]["indices"] == OFFSLICE_TOP:
            c = [c for c in r["coefficients"] if int(c["order"]) == 0][0]
            s = c["value"]["re"]
            k = 0
            started = False
            out = list(s)
            for i, ch in enumerate(out):
                if ch.isdigit() and (started or ch != "0"):
                    started = True
                    k += 1
                    if k == 20:
                        hit = (ch, str((int(ch) + 1) % 10))
                        out[i] = hit[1]
                        break
            c["value"]["re"] = "".join(out)
    assert hit is not None, "the top master's eps^0 string was not found in the reference"
    fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644)
    with os.fdopen(fd, "w") as f:
        json.dump(d, f, indent=1)
    return hit


def offslice_subprocess(cmd, workdir, label):
    """run one vendored module (the engine or the gate) with its lines forwarded; returns (rc, last line)."""
    import subprocess
    env = dict(os.environ)
    env["PYTHONDONTWRITEBYTECODE"] = "1"
    last = ""
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, cwd=workdir, env=env)
    for ln in p.stdout:
        ln = ln.rstrip("\n")
        if "[progress]" in ln:
            continue
        last = ln
        print(f"  [{label}] {ln}", flush=True)
    return p.wait(), last


def offslice_transport(seed_file, seed_label, route, dps, workdir, tag):
    """the vendored engine as a subprocess: the seed file, its point of record (= the route start), the route, --dps;
    the PREDICTION receipt under workdir.  Exit 2 / 5 by name when the engine refuses or stops."""
    import subprocess
    xy = os.path.join(HERE, OFFSLICE_XY)
    route_path = os.path.join(workdir, f"route_{tag}.json")
    with open(route_path, "w") as f:
        json.dump(route, f, indent=1)
    out = os.path.join(workdir, f"PREDICTION_{tag}.json")
    seed_path = os.path.join(HERE, seed_file)
    sp = ",".join(OFFSLICE_SEED["point"])
    cmd = [_sys.executable, os.path.join(xy, "transport_xy.py"), "--seed", seed_path, f"--seed-point={sp}", f"--start={sp}",
           "--route-json", route_path, "--dps", str(dps), "--out", out]
    print(f"  [engine] transport_xy.py --seed {os.path.basename(seed_file)} ({seed_label}) --seed-point={sp} --start={sp} "
          f"--route-json {os.path.basename(route_path)} --dps {dps} --out {os.path.basename(out)}", flush=True)
    t0 = time.time()
    rc, last = offslice_subprocess(cmd, workdir, "engine")
    wall = round(time.time() - t0, 1)
    if rc == 2:
        offslice_die(OFFSLICE_RC["refused"], f"icc-evaluate REFUSED (the engine): {last}")
    if rc == 5:
        offslice_die(OFFSLICE_RC["engine"], f"icc-evaluate ENGINE STOPPED on the route (a singular point of the connection on a segment; "
                                           f"the route does not steer around the census curves): {last}")
    if rc != 0 or not os.path.exists(out):
        offslice_die(OFFSLICE_RC["engine"], f"icc-evaluate ENGINE FAILED: rc {rc}; last line: {last!r}")
    return json.load(open(out)), out, wall


def offslice_print_values(pred, X, Y, dps):
    T = pred["transported"]["TARGET"]
    print(f"\n  the nine off-slice masters at (p12^2, p34^2) = ({X}, {Y}), eps^-2..eps^1, transported at dps {dps} "
          f"(printed at {dps + 5} significant digits; im at 8; a master's orders below its lead order are absent):")
    for m in pred["connection"]["masters"]:
        for K in range(pred["kmin"], pred["kmax"] + 1):
            key = f"{m}|{K}"
            if key in T["values"]:
                v = T["values"][key]
                im = "" if v["im"] in ("0.0", "0") else f"  (im {v['im']})"
                print(f"    {m} eps^{K:+d}: {v['re']}{im}")
    print(f"  the route record (per segment): " + "; ".join(
        f"{g['to']}: {g['steps']} steps, min step {g['min_step']:.3g}, tail bound {g['tail_bound_total']:.2e}, "
        f"nearest root on the segment {g['min_dist_to_root_on_segment'][:8]}, imag part at the end {g['imag_rel_at_end']:.1e}, "
        f"{g['wall_s']} s" for g in pred["legs"]))
    print(f"  order {pred['order']} at dps {dps} ({pred['n_state']} state components); the imaginary part at the target "
          f"relative to the largest component: {T['imag_rel']:.1e}; engine wall {pred['wall_s_total']} s")


def offslice_gate(pred_path, tag, ref, which, dps, workdir, label, mutate=False):
    """the vendored gate as a subprocess: the transported Laurent vs one vendored AMFlow value (bar 30 on every pair).
    Returns (n_fail, the receipt)."""
    xy = os.path.join(HERE, OFFSLICE_XY)
    rel = ref["files"][which]
    ref_path = os.path.join(HERE, rel)
    note = ""
    if mutate:
        mpath = os.path.join(workdir, f"MUTATED_{os.path.basename(rel)}")
        before, after = offslice_mutate_reference(ref_path, mpath)
        ref_path = mpath
        note = (f" [NEGATIVE CONTROL: the top master's eps^0 string of {os.path.basename(rel)} perturbed at its 20th "
                f"significant digit ({before} -> {after}) in a copy the gate reads; the file and its pin untouched -- "
                f"the gate MUST fail]")
    out = os.path.join(workdir, f"COMPARE_{label}.json")
    cmd = [_sys.executable, os.path.join(xy, "compare_xy.py"), "--prediction", pred_path, "--target", "TARGET",
           "--amflow", f"{os.path.basename(rel)}={ref_path}", "--bar", f"{OFFSLICE_BAR:g}", "--label", label, "--out", out]
    if mutate:
        cmd.append("--expect-fail")
    print(f"\n  [gate] {tag} = ({ref['point'][0]}, {ref['point'][1]}) vs the vendored AMFlow value {os.path.basename(rel)} "
          f"({which}, eps_order 5, eps^-2..eps^1; never a transport input){note}", flush=True)
    rc, last = offslice_subprocess(cmd, workdir, "gate")
    if not os.path.exists(out):
        offslice_die(OFFSLICE_RC["engine"], f"icc-evaluate GATE FAILED to run: rc {rc}; last line: {last!r}")
    C = json.load(open(out))
    W = C["worst"]
    po = C["per_order_floor_with_member"]
    rec = ref["record"].get(which)
    print(f"    worst {W['agree_d']} d = master {W['master']} eps^{W['order']} ({C['n_rows']} pairs, identical strings "
          f"{C['identical_strings']}, cap {W['cap_d']}); per order " + ", ".join(
              f"eps^{k} {po[k]['min']} d ({po[k]['member']['master']}, n {po[k]['n']})" for k in sorted(po, key=int)))
    if rec:
        print(f"    the record's floor at this point vs {which}: {rec['floor']} digits (measured {rec['worst_d']} d, master "
              f"{rec['member_master']} at eps^{rec['member_order']}; per order " + ", ".join(
                  f"eps^{k} {v}" for k, v in rec["per_order_min"].items()) + "; the goal-40 eps_order-5 seed caps the "
              f"transported values: a floor of a two-string agreement, never a precision claim on the AMFlow record)")
    fails = C["fails_by_name"]
    ftxt = "; ".join(f"{r['master']} eps^{r['order']} {r['agree_d']} d" for r in fails[:6])
    print(f"    bar {OFFSLICE_BAR:g} on every pair: " + ("PASS" if not fails else "FAIL by name: " + ftxt) + f" ({C['verdict']})")
    return len(fails), C


def offslice_pair(pred_a, pred_b, tag, dps, workdir, label, record_floor=None):
    """two transports (the goal-40 and goal-60 seeds) compared component-wise by the vendored gate (--pair; bar 30)."""
    xy = os.path.join(HERE, OFFSLICE_XY)
    out = os.path.join(workdir, f"COMPARE_{label}.json")
    cmd = [_sys.executable, os.path.join(xy, "compare_xy.py"), "--prediction", pred_a, "--target", "TARGET", "--pair", pred_b,
           "--bar", f"{OFFSLICE_BAR:g}", "--label", label, "--out", out]
    print(f"\n  [seed twin] the transport from the goal-40 seed vs the transport from the goal-60 seed at ({tag}), both at dps {dps}", flush=True)
    rc, last = offslice_subprocess(cmd, workdir, "gate")
    if not os.path.exists(out):
        offslice_die(OFFSLICE_RC["engine"], f"icc-evaluate SEED-TWIN COMPARISON FAILED to run: rc {rc}; last line: {last!r}")
    C = json.load(open(out))
    W = C["worst"]
    po = C["per_order_floor_with_member"]
    print(f"    twin agreement: worst {W['agree_d']} d = master {W['master']} eps^{W['order']} ({C['n_rows']} components, identical "
          f"{C['identical_strings']}, cap {W['cap_d']}); per order " + ", ".join(f"eps^{k} {po[k]['min']} d" for k in sorted(po, key=int))
          + " (the eps^1 floor ~ the seeds' own depth: the goal-40 eps_order-5 seed)")
    if record_floor:
        print(f"    the record's seed-twin floor at this point: {record_floor['floor']} (measured {record_floor['worst_d']} d)")
    fails = C["fails_by_name"]
    print(f"    bar {OFFSLICE_BAR:g}: {'PASS' if not fails else 'FAIL by name'} ({C['verdict']})")
    return len(fails), C


def offslice_main(args):
    """--offslice X Y [--dps N] [--seed-twin] [--mutate] [--workdir DIR]: the driver."""
    from fractions import Fraction as _F
    import tempfile
    t_all = time.time()
    dps = args.dps if args.dps is not None else 60
    try:
        X, Y = _F(args.offslice[0].strip()), _F(args.offslice[1].strip())
    except (ValueError, ZeroDivisionError):
        offslice_die(OFFSLICE_RC["refused"], f"icc-evaluate REFUSED: --offslice takes two exact rationals (X = p12^2, Y = p34^2), "
                                            f"got {args.offslice[0].strip()!r} {args.offslice[1].strip()!r}")
    if dps < 30:
        offslice_die(OFFSLICE_RC["refused"], "icc-evaluate REFUSED: --offslice runs at --dps >= 30 (the record's precisions 45 and 60)")
    print(f"[mode] THE OFF-SLICE (X, Y) ARM: (p12^2, p34^2) = ({X}, {Y}) at dps {dps}: the nine off-slice masters at eps^-2..eps^1 "
          f"transported from the seed of record at (-3, -4) along the vendored two-variable connection (minutes on one core at "
          f"dps 60; the WALLS of the docstring)" + (" + the goal-60 seed twin" if args.seed_twin else "")
          + (" -- MUTATION CONTROL" if args.mutate else ""))
    print("[scope] no value ON the slice x = y (refused by name; the default tiers cover the slice); no AMFlow-free off-slice "
          "value (the seed is the AMFlow value of record at (-3, -4)); nothing beyond eps^1; the reference points carry the "
          "record's floors, the run's own floor is the figure")
    npins = offslice_check_pins()
    print(f"[pins] {npins} shipped files verified by sha256 (the xy/ directory, the served seed, the served parser)")
    ap_json = json.load(open(os.path.join(HERE, OFFSLICE_XY, "A_point.json")))
    d2 = ap_json["denominator_factors_at_d2"]
    factors = sorted(set(d2["A_x"]) | set(d2["A_y"]))
    print(f"[connection] xy/A_xy_eps_monomial.json: {ap_json['n_masters']} masters, integrability of record: "
          f"{ap_json['integrability']['verdict']}; the census at d = 2: {len(factors)} denominator factors")
    offslice_refuse(X, Y, factors)
    tag, ref = offslice_reference_at(X, Y)
    if args.mutate and ref is None:
        offslice_die(OFFSLICE_RC["refused"], f"icc-evaluate REFUSED: --mutate exercises the gate at a reference point "
                                            f"({', '.join('(' + r['point'][0] + ', ' + r['point'][1] + ')' for r in OFFSLICE_REFERENCES.values())}); "
                                            f"({X}, {Y}) carries no vendored AMFlow value")
    route, route_txt, ncross = offslice_route(X, Y, factors)
    print(f"[route] (-3, -4) {route_txt}" + (f" ({ncross} chord(s) cross the apparent diagonal x = y: the detour)" if ncross else " (no chord crosses the diagonal x = y)"))
    if ref is not None:
        print(f"[reference] ({X}, {Y}) is the reference point {tag}: the gate against " + " and ".join(
            f"{os.path.basename(f)} ({w})" for w, f in ref["files"].items()) + f" follows the transport (bar {OFFSLICE_BAR:g})")
    else:
        print(f"[reference] ({X}, {Y}) carries no vendored AMFlow value: the transported masters are printed, no gate")
    workdir = args.workdir or tempfile.mkdtemp(prefix="icc-offslice-xy-")
    os.makedirs(workdir, exist_ok=True)
    print(f"[workdir] {os.path.basename(workdir)}/ (the engine's PREDICTION and the gate's COMPARE receipts)")
    n_fail = 0
    caught = None
    pred, pred_path, wall = offslice_transport(OFFSLICE_SEED["file"], OFFSLICE_SEED["label"], route, dps, workdir, "g40")
    offslice_print_values(pred, X, Y, dps)
    gates = []
    if ref is not None:
        for which in ref["files"]:
            if which != "goal 40" and args.mutate:
                continue
            nf, C = offslice_gate(pred_path, tag, ref, which, dps, workdir, f"{tag}_{which.replace(' ', '')}_dps{dps}", mutate=(args.mutate and which == "goal 40"))
            gates.append((which, nf, C["worst"]["agree_d"], C["floor"]))
            if args.mutate and which == "goal 40":
                caught = nf > 0
            else:
                n_fail += nf
        if "goal 60" not in ref["files"]:
            print(f"    (no goal-60 AMFlow twin at {tag}: the mirror point carries one goal-40 value; its two-precision pair is the dps 45/60 transport pair)")
    if args.seed_twin:
        pred2, pred2_path, wall2 = offslice_transport(OFFSLICE_SEED_TWIN["file"], OFFSLICE_SEED_TWIN["label"], route, dps, workdir, "g60")
        nf, C = offslice_pair(pred_path, pred2_path, f"{X}, {Y}", dps, workdir, f"SEEDTWIN_dps{dps}", record_floor=(ref or {}).get("seed_twin_record"))
        n_fail += nf
        gates.append(("seed twin", nf, C["worst"]["agree_d"], C["floor"]))
        if ref is not None and "goal 60" in ref["files"] and not args.mutate:
            nf, C = offslice_gate(pred2_path, tag, ref, "goal 60", dps, workdir, f"{tag}_goal60_twin_dps{dps}")
            n_fail += nf
            gates.append(("goal-60 transport vs goal 60", nf, C["worst"]["agree_d"], C["floor"]))
    wall_all = round(time.time() - t_all, 1)
    if args.mutate:
        verdict = "MUTATION CAUGHT (the gate FAILS by name, as expected)" if caught else "MUTATION NOT CAUGHT (a defect of the control)"
        rc = OFFSLICE_RC["fail"] if caught else OFFSLICE_RC["not_caught"]
    else:
        verdict = "PASS" if n_fail == 0 else "FAIL"
        rc = 0 if n_fail == 0 else OFFSLICE_RC["fail"]
    print(f"\nVERDICT {verdict}: (p12^2, p34^2) = ({X}, {Y}) at dps {dps}: the nine masters at eps^-2..eps^1 transported from (-3, -4) "
          f"({sum(g['steps'] for g in pred['legs'])} steps over {len(pred['legs'])} segment(s), engine wall {pred['wall_s_total']} s)"
          + ("; " + "; ".join(f"{w}: worst {d} d (floor {fl}) vs bar {OFFSLICE_BAR:g}, {'met' if nf == 0 else str(nf) + ' pair(s) FAIL by name'}" for w, nf, d, fl in gates) if gates else "; no reference at this point")
          + f"; total wall {wall_all} s")
    return rc


# ---------------------------------------------------------------------------
# THE MINKOWSKI (i0+) ARM (2026-09-06): the equal-mass slice connection
# continued into the Minkowski region x > 0.  With the propagators' +i0 every
# timelike invariant carries s -> s + i0, i.e. x -> x + i0 on the slice: the
# physical value is the boundary value from the UPPER half x-plane.  The arm
# derives the served seeds at runtime (eqmass_derived_seeds, the code path of
# every equal-mass tier), builds the served graded 21-component system
# (build_system) and transports it along the complex detour
#     -1 -> -1 + iH -> X + iH -> X          (H = 2 by default)
# above every real singular point of the connection ({-1/2, -1/4}, the cusps
# {0, 1, 9}, the bubble locus r+- = 5 +- 2 sqrt 5) with a NEW complex-step unit
# in mpc arithmetic (minkowski_taylor_coeffs: the served taylor_step's
# recursion at a complex expansion point, rat_taylor CALLED for the
# connection's Taylor coefficients; the served real-axis taylor_step itself
# is untouched).  The step control is the record engine's: |h| = hfrac x the
# distance to the nearest declared singular point in the complex plane, hfrac
# from 1/2 and halved while the certified geometric tail bound of the Taylor
# series fails 10^-(dps+8) relative to the state (regrown x2 after a step);
# the lower detour (H -> -H) is the x - i0 boundary value = the complex
# conjugate (Schwarz reflection: real seeds, real-rational connection); a
# second upper route (H + 1) is the route-independence control.  At X = 12
# the transported values are gated against the two vendored AMFlow
# physical-region records (icc-reference-minkowski.json, sha256-pinned below).
# See THE MINKOWSKI (i0+) ARM in the docstring.
# ---------------------------------------------------------------------------
MINKOWSKI_REFERENCE = {
    "file": "icc-reference-minkowski.json",
    "sha256": "09eff50f2a80d2d7e64d565373f4e1a0ae3ffe829d14717df078136f84ae6bbf",
    "x": "12",
    "records": ("XM12_g40", "XM12_g60"),   # AMFlow goal 40 and goal 60, eps_order 4 (eps^-2..eps^0), the same point
    "certified_digits": 57,   # floor(the record's AMFlow pair floor, goal 40 vs goal 60: 57.90 d at (6,0))
    "exit_code_mismatch": 3,   # the bundle's pin codes
    "exit_code_missing": 4,
}
MINKOWSKI_RC = {"fail": 1, "refused": 2, "pin_mismatch": 3, "missing": 4, "not_caught": 6}
# the declared singular points of the 7-master connection (the denominator factors x - 9, x - 1, 4x + 1, 2x + 1,
# x^2 - 10x + 5 and x of the served 'eqmass' coef block) and, from the record's residue census, the pole order of
# A^(k) at each for the grades k = 0..3 and the local exponents (eigenvalues of Res A^(0)):
MINKOWSKI_SINGULAR = (
    ('-1/2', '-1/2', {0: 1, 1: 2, 2: 3, 3: 4}, {'0': 6, '1': 1}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('-1/4', '-1/4', {0: 1, 1: 1, 2: 0, 3: 0}, {'0': 5, '1/2': 2}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('0', '0', {0: 1, 1: 1, 2: 1, 3: 1}, {'0': 6, '-2': 1}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('1', '1', {0: 1, 1: 1, 2: 1, 3: 1}, {'0': 6, '-1': 1}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('9', '9', {0: 1, 1: 1, 2: 1, 3: 1}, {'0': 7}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('r-', '5 - 2*sqrt(5)', {0: 1, 1: 1, 2: 1, 3: 1}, {'0': 7}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
    ('r+', '2*sqrt(5) + 5', {0: 1, 1: 1, 2: 1, 3: 1}, {'0': 7}),   # value, pole order of A^(k) by grade k = 0..3, local exponents at eps^0 (multiplicities)
)
MINKOWSKI_THRESHOLDS = ("0", "1", "9", "r-", "r+")   # the threshold points: never landed (refused by name)
MINKOWSKI_H = 2            # the detour height of the route of record; the second upper route runs at H + 1
MINKOWSKI_RATIO = 0.5      # the record engine's initial / maximal step fraction of the distance to the nearest singular point
MINKOWSKI_GUARD = 8        # the tail bound must beat 10^-(dps + 8) relative to ||y||_inf
MINKOWSKI_MIN_HFRAC = 1 / 64   # below this step fraction the march refuses (a singular point too close to the path)
MINKOWSKI_MAX_STEPS = 400  # per leg
MINKOWSKI_MARGIN = 10      # the gate bar = min(dps, certified_digits) - MARGIN
MINKOWSKI_MUTATE = {"record": "XM12_g40", "component": (4, 0), "relative": "1e-25"}   # the --mutate control's form (the record's)
MINKOWSKI_RECORD = {
    "floors": {
        "XM12_g40": {
            "complex": 57.906109093946554,
            "complex_member": "(6,0)",
            "re": 57.90627009585975,
            "im": 59.04638076338619,
            "im_member": "(4,0)"
        },
        "XM12_g60": {
            "complex": 59.41208295384266,
            "complex_member": "(0,-1)",
            "re": 59.41208295384266,
            "im": 60.2061320988374,
            "im_member": "(2,0)"
        }
    },
    "amflow_pair": {
        "digits": 57.90408474657822,
        "member": "(6,0)"
    },
    "transport_pair_dps60_vs_90": {
        "digits": 59.41208295384266,
        "member": "(0,-1)"
    },
    "dps60": {
        "steps_upper": 101,
        "trunc_worst_upper": "9.56845e-69",
        "route_vs_route": 92.11742364984944,
        "schwarz": "identical on every member",
        "euclid_x-2_upper_vs_direct": 70.07468403257211,
        "euclid_x-2_vs_oracle_40": 62.07030861383643,
        "euclid_x-2_vs_oracle_41": 62.01150005867332
    },
    "dps90": {
        "steps_upper": 124,
        "trunc_worst_upper": "9.75619e-99",
        "route_vs_route": 122.26424623149533,
        "euclid_x-2_upper_vs_direct": 101.3970062228933
    },
    "monodromy_nontrivial": [
        "(2,0)",
        "(2,1)",
        "(3,0)",
        "(3,1)",
        "(4,0)",
        "(4,1)",
        "(5,0)",
        "(5,1)",
        "(6,0)",
        "(6,1)"
    ],
    "monodromy_trivial": [
        "(0,-2)",
        "(0,-1)",
        "(0,0)",
        "(0,1)",
        "(1,-1)",
        "(1,0)",
        "(1,1)",
        "(3,-2)",
        "(3,-1)",
        "(6,-2)",
        "(6,-1)"
    ]
}


def minkowski_die(rc, msg):
    print(msg, flush=True)
    raise SystemExit(rc)


def minkowski_singular_points():
    """the declared singular points as mpc at the CURRENT working precision, by name (call inside mp.workdps)."""
    s5 = sqrt(mpf(5))
    vals = {"-1/2": mpf(-1) / 2, "-1/4": mpf(-1) / 4, "0": mpf(0), "1": mpf(1), "9": mpf(9),
            "r-": 5 - 2 * s5, "r+": 5 + 2 * s5}
    return [(row[0], mp.mpc(vals[row[0]])) for row in MINKOWSKI_SINGULAR]


def minkowski_refuse(X, euclid_control):
    """the named refusals (exit 2), before any computation: X <= 0 (the Euclidean axis x < -1/2 is the served --point
    tier; -1/2 <= x <= 0 is not served) unless --euclid-control, which needs X < -1/2; the threshold points {0, 1, 9,
    r+-} themselves (X within 10^-6 of one) are never landed."""
    from fractions import Fraction as _F
    if euclid_control:
        if not (X < _F(-1, 2)):
            minkowski_die(MINKOWSKI_RC["refused"],
                          f"icc-evaluate REFUSED: --euclid-control runs the detour form to a Euclidean point X < -1/2 and "
                          f"compares it with the served real-axis march (got X = {X}); the Minkowski region is "
                          f"--minkowski X with X > 0")
        return
    if X <= 0:
        minkowski_die(MINKOWSKI_RC["refused"],
                      f"icc-evaluate REFUSED: --minkowski X = {X} is not in the Minkowski region x > 0. The Euclidean axis "
                      f"x < -1/2 is the served real-axis tier (--point {X}); -1/2 <= x <= 0 (the points -1/2, -1/4 and the "
                      f"cusp 0 lie there) is not served by either arm; the Euclidean-limit control of the detour form is "
                      f"--minkowski -2 --euclid-control")
    with mp.workdps(40):
        for name, z in minkowski_singular_points():
            if name in MINKOWSKI_THRESHOLDS and fabs(mpf(X.numerator) / X.denominator - z.real) < mpf(10) ** -6:
                minkowski_die(MINKOWSKI_RC["refused"],
                              f"icc-evaluate REFUSED: X = {X} is the threshold point {name} = {mp.nstr(z.real, 12)} (within "
                              f"10^-6): the threshold points themselves are not landed -- the connection is singular there "
                              f"(a simple pole of A^(k) at every grade) and the detour never lands on a singular point; "
                              f"the values AT the thresholds are not established")


def minkowski_load_reference(mutate=False):
    """the vendored x = 12 references read through their sha256 pin (fail closed, by name): exit 4 when the file is
    missing beside this script, exit 3 on a pin mismatch.  Returns (the object, {tag: {(master, order): {re, im, rad_re,
    rad_im, nd}}}) with the ball midpoints as strings; with mutate=True the XM12_g40 (4,0) Re midpoint is perturbed in
    memory by the relative amount MINKOWSKI_MUTATE['relative'] (the file and its pin untouched)."""
    import hashlib
    p = os.path.join(HERE, MINKOWSKI_REFERENCE["file"])
    if not os.path.exists(p):
        minkowski_die(MINKOWSKI_REFERENCE["exit_code_missing"],
                      f"icc-evaluate MISSING: pinned file {MINKOWSKI_REFERENCE['file']} is absent beside this file (the "
                      f"x = {MINKOWSKI_REFERENCE['x']} physical-region references); not serving --minkowski")
    got = hashlib.sha256(open(p, "rb").read()).hexdigest()
    if got != MINKOWSKI_REFERENCE["sha256"]:
        pos = next(i + 1 for i in range(64) if got[i] != MINKOWSKI_REFERENCE["sha256"][i])
        minkowski_die(MINKOWSKI_REFERENCE["exit_code_mismatch"],
                      f"icc-evaluate REFUSED: {MINKOWSKI_REFERENCE['file']} integrity pin mismatch: sha256 {got} != pinned "
                      f"{MINKOWSKI_REFERENCE['sha256']} (first differing hex position {pos} of 64, 1-based); not serving "
                      f"--minkowski")
    o = json.load(open(p))
    refs = {}
    for tag in MINKOWSKI_REFERENCE["records"]:
        rec = o["records"][tag]
        assert rec["goal_digits"] in (40, 60) and rec["point"]["p12sq"] == MINKOWSKI_REFERENCE["x"] and rec["point"]["p34sq"] == MINKOWSKI_REFERENCE["x"]
        R = {}
        for r in rec["results"]:
            i = r["index"]
            assert r["integral"] == DATA["eqmass"]["masters"][i], (i, r["integral"])
            for K, ball in r["eps"].items():
                re_mid, im_mid = ball["re"]["mid"], ball["im"]["mid"]
                nd = len(re_mid.replace("-", "").replace(".", "").lstrip("0"))
                if mutate and tag == MINKOWSKI_MUTATE["record"] and (i, int(K)) == tuple(MINKOWSKI_MUTATE["component"]):
                    with mp.workdps(nd + 20):
                        re_mid = mp.nstr(mpf(re_mid) * (1 + mpf(MINKOWSKI_MUTATE["relative"])), nd)
                R[(i, int(K))] = {"re": re_mid, "im": im_mid, "rad_re": ball["re"]["rad"], "rad_im": ball["im"]["rad"], "nd": nd}
        refs[tag] = R
    print(f"  [pin] {MINKOWSKI_REFERENCE['file']} sha256 {got[:16]}... VERIFIED ({os.path.getsize(p)} bytes): the x = "
          f"{MINKOWSKI_REFERENCE['x']} physical-region references, "
          + ", ".join(f"{t} (goal {o['records'][t]['goal_digits']}, eps_order {o['records'][t]['eps_order']}, "
                      f"{len(refs[t])} components, out {o['records'][t]['out_sha256'][:16]}...)" for t in refs)
          + f"; the record certifies {MINKOWSKI_REFERENCE['certified_digits']} digits (the AMFlow pair floor)")
    if mutate:
        print(f"  [NEGATIVE CONTROL] {MINKOWSKI_MUTATE['record']} component {tuple(MINKOWSKI_MUTATE['component'])} Re midpoint "
              f"perturbed in memory by a relative {MINKOWSKI_MUTATE['relative']} (the file and its pin untouched): the gate "
              f"MUST fail by name at that component")
    return o, refs


def minkowski_taylor_coeffs(y, z0, order, entries, coef, ns):
    """The complex-step twin of taylor_step's recursion, (n+1) a_{n+1} = sum_k M_k a_{n-k}, at a COMPLEX expansion
    point z0 in mpc arithmetic, returning the coefficient history hist[m][n] = a_n[m] (the sum at a step h is taken by
    minkowski_sum, so one recursion serves every trial step of the step control).  The connection's Taylor
    coefficients about z0 come from the served rat_taylor (exact rational p/q, series division) -- called, not copied."""
    tc = {key: rat_taylor(num, den, z0, order) for key, (num, den) in coef.items()}
    hist = [[y[m]] for m in range(ns)]          # hist[m][n] = a_n[m]
    rev = [[y[m]] for m in range(ns)]           # rev[m] = hist[m] reversed
    for n in range(order):
        s = [mp.mpc(0)] * ns
        for row, col, key in entries:
            c = tc[key]
            r = rev[col]
            s[row] += sum(ck * ak for ck, ak in zip(c, r))
        for m in range(ns):
            an1 = s[m] / (n + 1)
            hist[m].append(an1)
            rev[m].insert(0, an1)
    return hist


def minkowski_tail(hist, hmag, ns, wp, dps):
    """The record engine's acceptance rule on a coefficient history at a trial step magnitude hmag: the term
    magnitudes t_n = max_m |a_n[m]| hmag^n; the geometric tail bound from the last two ABOVE-FLOOR terms (indices a < b,
    gap-normalised ratio r = (t_b/t_a)^(1/(b-a)) clamped at 3/4, bound = (t_a + t_b)/(1 - r)); an early break at the
    first order > 9 whose fresh above-floor pair passes the threshold 10^-(dps+8) x ||y||_inf, else the fixed top
    order (an all-zero trailing window never accepts early).  Returns (order_used, bound, threshold, ynorm)."""
    order = len(hist[0]) - 1
    ynorm = max(abs(hist[m][0]) for m in range(ns))
    tiny = mpf(10) ** (-(4 * wp))
    thresh = mpf(10) ** (-(dps + MINKOWSKI_GUARD)) * max(ynorm, tiny)
    flr_rel = mpf(10) ** (-(wp - 10))

    def tail_nz(t_a, t_b, gap):
        r = (t_b / t_a) ** (mpf(1) / gap)
        if r > mpf(3) / 4:
            r = mpf(3) / 4
        return (t_a + t_b) / (1 - r)

    def tail_raw(t_prev, t_last):
        if t_prev == 0 and t_last == 0:
            return mpf(0)
        r = min(mpf(3) / 4, t_last / t_prev) if t_prev > 0 else mpf(1) / 2
        return (t_last + t_prev) / (1 - r)

    tmag = [ynorm]
    tmax_run = ynorm
    nz_prev = None
    nz_last = (0, ynorm)
    gap_max = 0
    bound = None
    used = order
    hp = mpf(1)
    for idx in range(1, order + 1):
        hp *= hmag
        tm = max(abs(hist[m][idx]) for m in range(ns)) * hp
        tmag.append(tm)
        if tm > tmax_run:
            tmax_run = tm
        if tm > flr_rel * tmax_run:
            g = idx - nz_last[0]
            if g > gap_max:
                gap_max = g
            nz_prev = nz_last
            nz_last = (idx, tm)
        if idx - 1 > 8 and nz_prev is not None and idx - nz_last[0] < gap_max:
            b = tail_nz(nz_prev[1], nz_last[1], nz_last[0] - nz_prev[0])
            if b < thresh:
                bound, used = b, idx
                break
    if bound is None:
        if nz_prev is not None and order - nz_last[0] <= gap_max:
            bound = tail_nz(nz_prev[1], nz_last[1], nz_last[0] - nz_prev[0])
        else:
            bound = tail_raw(tmag[-2], tmag[-1])
    return used, bound, thresh, ynorm


def minkowski_sum(hist, h, used, ns):
    """the Taylor sum of the history through order 'used' at the complex step h (Horner)."""
    out = []
    for m in range(ns):
        acc = mp.mpc(0)
        for a in reversed(hist[m][:used + 1]):
            acc = acc * h + a
        out.append(acc)
    return out


def minkowski_march(y, za, zb, sings, dps, wp, order, entries, coef, ns, diag):
    """one straight leg za -> zb of a route by the record engine's step control: |h| = hfrac x the distance to the
    nearest declared singular point (hfrac from MINKOWSKI_RATIO, halved while the tail bound fails, regrown x2 after
    an accepted step), the final step exact; the coefficient history is computed ONCE per expansion point and re-used
    for every trial step.  Refuses by name (RuntimeError -> exit 1) when hfrac would drop below 1/64 or a leg exceeds
    400 steps -- a singular point too close to the path (not on the routes served).  Updates diag in place."""
    z = mp.mpc(za)
    if abs(zb - z) == 0:
        return y
    hfrac = mpf(MINKOWSKI_RATIO)
    tiny = mpf(10) ** (-(4 * wp))
    steps = 0
    while True:
        rem = abs(zb - z)
        if rem == 0:
            break
        unit = (zb - z) / rem
        dsing = min(abs(z - s) for _, s in sings)
        hist = minkowski_taylor_coeffs(y, z, order, entries, coef, ns)
        while True:
            hmag = hfrac * dsing
            if hmag >= rem:
                hmag = rem
            used, bound, thresh, ynorm = minkowski_tail(hist, hmag, ns, wp, dps)
            if bound < thresh:
                break
            hfrac = hfrac / 2
            if hfrac < mpf(MINKOWSKI_MIN_HFRAC):
                raise RuntimeError(
                    f"--minkowski march: step {steps} at z = {mp.nstr(z, 8)} cannot converge even at a step fraction "
                    f"< 1/64 of the distance {mp.nstr(dsing, 6)} to the nearest declared singular point (geometric tail "
                    f"bound {mp.nstr(bound, 3)} vs threshold {mp.nstr(thresh, 3)}) -- a singular point too close to "
                    f"the route; refusing (rc 1)")
        h = hmag * unit
        y = minkowski_sum(hist, h, used, ns)
        z = z + h
        steps += 1
        diag["steps"] += 1
        trunc_rel = bound / max(ynorm, tiny)
        if trunc_rel > diag["trunc_worst"]:
            diag["trunc_worst"] = trunc_rel
        if hfrac < diag["min_hfrac"]:
            diag["min_hfrac"] = hfrac
        if used > diag.get("order_used_max", 0):
            diag["order_used_max"] = used
        hfrac = min(mpf(MINKOWSKI_RATIO), hfrac * 2)
        if steps > MINKOWSKI_MAX_STEPS:
            raise RuntimeError(
                f"--minkowski march: more than {MINKOWSKI_MAX_STEPS} steps on the leg {mp.nstr(za, 8)} -> "
                f"{mp.nstr(zb, 8)} -- a singular point near the route; refusing (rc 1)")
    return y


def minkowski_route(y0, xb, X, H, dps, entries, coef, ns, label):
    """the detour xb -> xb + iH -> X + iH -> X (H > 0: the upper half-plane = x + i0, the physical sheet; H < 0: the
    lower = x - i0, the conjugate) at the working precision dps + 33 with the Taylor order max(60, 0.75 dps + 25) (the
    record engine's defaults); returns (the values as mpc, the diagnostics)."""
    wp = dps + MINKOWSKI_GUARD + 25
    order = max(60, int(0.75 * dps) + 25)
    with mp.workdps(wp):
        xm = mpf(X.numerator) / X.denominator
        hm = mpf(H.numerator) / H.denominator
        pts = [mp.mpc(xb), mp.mpc(xb, hm), mp.mpc(xm, hm), mp.mpc(xm)]
        sings = minkowski_singular_points()
        for name, s in sings:
            if abs(mp.mpc(xm) - s) < mpf(10) ** (-max(10, dps // 2)):
                raise RuntimeError(f"the end point X = {X} is the declared singular point {name}; not landed")
        y = [mp.mpc(v) for v in y0]
        diag = {"steps": 0, "trunc_worst": mpf(0), "min_hfrac": mpf(MINKOWSKI_RATIO), "order": order, "wp": wp,
                "path": [mp.nstr(p, 10) for p in pts]}
        t0 = time.time()
        for k in range(3):
            y = minkowski_march(y, pts[k], pts[k + 1], sings, dps, wp, order, entries, coef, ns, diag)
        diag["wall_s"] = time.time() - t0
    print(f"    [{label}: {diag['steps']} steps of order <= {order} (used <= {diag.get('order_used_max', order)}) at "
          f"working dps {wp}; trunc_worst {mp.nstr(diag['trunc_worst'], 3)}; min step fraction "
          f"{mp.nstr(diag['min_hfrac'], 4)}; {diag['wall_s']:.1f} s]", flush=True)
    return y, diag


def minkowski_digits(a, b):
    """digits of agreement of a with the reference b (|a - b| relative to |b|, or to 1 when b = 0); None when identical."""
    d = abs(a - b)
    if d == 0:
        return None
    ref = abs(b) if abs(b) != 0 else mpf(1)
    return float(-log10(d / ref))


def minkowski_floor(dmap):
    """(the floor over the non-identical members, its member, the identical members); (None, None, all) when all identical."""
    vals = [(d, k) for k, d in dmap.items() if d is not None]
    ident = sorted(k for k, d in dmap.items() if d is None)
    if not vals:
        return None, None, ident
    fl = min(vals)
    return fl[0], fl[1], ident


def minkowski_print_values(vals, state, dps, label):
    """Re and Im per component at dps, with the monodromy record (which components resolved an imaginary part:
    |Im| / max(|value|, 1) > 10^-(dps - 10)); returns (the nontrivial list, the trivial list)."""
    print(f"\n  {label}: the 21 components (master, eps order) at dps {dps} (Re, Im)")
    mp.dps = dps
    nontriv, triv = [], []
    for n, (i, K) in enumerate(state):
        v = vals[n]
        ref = max(abs(v), mpf(1))
        res = bool(fabs(v.imag) / ref > mpf(10) ** (-(dps - 10)))
        (nontriv if res else triv).append(f"({i},{K})")
        print(f"    ({i},{K:+d}) {DATA['eqmass']['masters'][i]}  Re {mp.nstr(v.real, dps)}  Im {mp.nstr(v.imag, dps)}"
              f"{'' if res else '  [Im below 10^-(dps-10): no discontinuity resolved]'}")
    print(f"    monodromy: an imaginary part resolved on {len(nontriv)} of {len(state)} components {nontriv}; "
          f"none on {len(triv)}: {triv}")
    return nontriv, triv


def minkowski_gate(vals, state, refs, tag, meta, dps, bar, label, expect_fail=None):
    """the gate of the transported values against ONE vendored record: per component (master, order) the digits of
    agreement of the complex value, of Re and of Im (each relative to |record|); 'identical (N)' when the difference is
    below the record's printed resolution 10^-N; the floors with members; every gated component must meet the bar on
    all three (FAIL by name).  Returns (verdict, floors, members)."""
    mp.dps = max(dps + 20, max(r["nd"] for r in refs.values()) + 20)   # the record strings parsed whole
    idx = {s: n for n, s in enumerate(state)}
    members = {}
    print(f"\n  {label} vs {tag} (AMFlow goal {meta['goal_digits']}, eps_order {meta['eps_order']}, "
          f"{meta['n_results']} results x eps^-2..eps^0 = {len(refs)} components; out {meta['out_sha256'][:16]}...); "
          f"bar {bar:.1f} d = min(dps {dps}, the record's certified {MINKOWSKI_REFERENCE['certified_digits']}) - "
          f"{MINKOWSKI_MARGIN} on Re, Im and the complex value")
    print(f"    {'component':<9} {'integral':<24} {'record d':>8} {'Re':>8} {'Im':>8} {'complex':>8}  verdict")
    fails = []
    for (i, K), rec in sorted(refs.items()):
        if (i, K) not in idx:
            members[f"({i},{K})"] = {"verdict": "NO PREDICTION (component outside the transported state)"}
            continue
        v = vals[idx[(i, K)]]
        r = mp.mpc(mpf(rec["re"]), mpf(rec["im"]))
        nd = rec["nd"]
        refm = abs(r) if abs(r) != 0 else mpf(1)
        res = {}
        for name, d in (("complex", abs(v - r)), ("re", fabs(v.real - r.real)), ("im", fabs(v.imag - r.imag))):
            if d == 0 or d < mpf(10) ** (-nd) * refm:
                res[name] = (float(nd), True)
            else:
                res[name] = (float(-log10(d / refm)), False)
        worst = min(res[n][0] for n in res)
        ok = worst >= bar
        members[f"({i},{K})"] = {"complex": res["complex"], "re": res["re"], "im": res["im"], "record_digits": nd,
                                 "im_resolved_in_record": bool(fabs(r.imag) > mpf(10) ** (-(nd - 3)) * refm),
                                 "verdict": "PASS" if ok else "FAIL"}
        if not ok:
            fails.append(f"({i},{K})")

        def cell(x):
            return f"={x[0]:.0f}" if x[1] else f"{x[0]:8.1f}"
        print(f"    ({i},{K:+d})    {str(DATA['eqmass']['masters'][i]):<24} {nd:>8} {cell(res['re']):>8} {cell(res['im']):>8} "
              f"{cell(res['complex']):>8}  {'PASS' if ok else 'FAIL'}")
    gated = {k: m for k, m in members.items() if "complex" in m}
    floors = {}
    for name in ("complex", "re", "im"):
        fl, mem, ident = minkowski_floor({k: (None if m[name][1] else m[name][0]) for k, m in gated.items()})
        floors[name] = {"digits": fl, "member": mem, "identical": {k: gated[k]["record_digits"] for k in ident}}
    fl, mem, ident = minkowski_floor({k: (None if m["im"][1] else m["im"][0]) for k, m in gated.items() if m["im_resolved_in_record"]})
    floors["im_over_resolved"] = {"digits": fl, "member": mem, "identical": {k: gated[k]["record_digits"] for k in ident}}
    verdict = "PASS" if (gated and not fails) else "FAIL"

    def ftxt(f):
        return ("identical on every member" if f["digits"] is None else f"{f['digits']:.1f} d at {f['member']}") + \
            (f"; identical (N) on {sorted(f['identical'])}" if f["identical"] else "")
    print(f"    floors: complex {ftxt(floors['complex'])}; Re {ftxt(floors['re'])}; Im {ftxt(floors['im'])}; "
          f"Im over the components with a resolved imaginary part {ftxt(floors['im_over_resolved'])}")
    print(f"    [gate] {tag}: {verdict} {len(gated) - len(fails)} pass / {len(fails)} fail of {len(gated)} gated"
          f"{' -- FAIL at ' + ', '.join(fails) if fails else ''} (bar {bar:.1f} d; below-bar RAISES, rc 1)")
    rec_floor = MINKOWSKI_RECORD["floors"].get(tag)
    if rec_floor:
        print(f"    (the record's floors at dps 60: complex {rec_floor['complex']:.1f} d at {rec_floor['complex_member']}, "
              f"Re {rec_floor['re']:.1f} d, Im {rec_floor['im']:.1f} d at {rec_floor['im_member']})")
    return verdict, floors, members


def minkowski_main(args):
    """--minkowski X driver: the refusals, the pin, the seeds and system by the served code path, the routes, the
    controls, the gate at X = 12, the summary line and the exit code."""
    from fractions import Fraction as _F
    t_all = time.time()
    try:
        X = _F(args.minkowski.strip())
    except (ValueError, ZeroDivisionError):
        minkowski_die(MINKOWSKI_RC["refused"], f"icc-evaluate REFUSED: --minkowski X must be an exact rational (got "
                                               f"{args.minkowski!r})")
    dps = args.dps if args.dps is not None else 60
    H = _F(args.detour) if args.detour is not None else _F(MINKOWSKI_H)
    if H <= 0:
        minkowski_die(MINKOWSKI_RC["refused"], f"icc-evaluate REFUSED: --detour H must be positive (the upper half-plane; "
                                               f"the lower detour is run as the control); got {H}")
    if args.mutate and args.mutate_sign:
        minkowski_die(MINKOWSKI_RC["refused"], "icc-evaluate REFUSED: --mutate and --mutate-sign are separate controls; pass one")
    minkowski_refuse(X, args.euclid_control)
    gate_point = (not args.euclid_control) and X == _F(MINKOWSKI_REFERENCE["x"])
    if (args.mutate or args.mutate_sign) and not gate_point:
        minkowski_die(MINKOWSKI_RC["refused"], f"icc-evaluate REFUSED: --mutate / --mutate-sign exercise the gate at X = "
                                               f"{MINKOWSKI_REFERENCE['x']} (pass --minkowski {MINKOWSKI_REFERENCE['x']})")
    print("=" * 78)
    if args.euclid_control:
        print(f"ICC equal-mass masters by the i0+ DETOUR FORM at the Euclidean point x = {X} (the control):")
        print(f"the detour -1 -> -1 + {H}i -> {X} + {H}i -> {X} vs the served real-axis march and the stored oracle strings")
    else:
        print(f"ICC equal-mass masters at the MINKOWSKI point x = {X} + i0 by the i0+ detour of the slice connection")
        print(f"(x -> x + i0: the boundary value from the upper half x-plane; the route -1 -> -1 + {H}i -> {X} + {H}i -> {X})")
    print("=" * 78)
    # the references FIRST (the pin before any computation), only at the gate point
    ref_obj = refs = None
    if gate_point:
        ref_obj, refs = minkowski_load_reference(mutate=bool(args.mutate))
    # the seeds and the system: the served code path of every equal-mass tier
    seeds, diag, defit, dwall = eqmass_derived_seeds(dps)
    print_boundary_block("eqmass", dict(kind="derived", seeds=seeds, diag=diag, defit=defit, wall=dwall), spectral=False)
    mp.dps = dps + 40
    state, idx, entries, coef, y0, xb = build_system("eqmass", seeds)
    ns = len(state)
    print(f"    [eqmass: {ns}-component graded state (7 masters x eps^-2..eps^1), {len(entries)} couplings; seeds derived "
          f"at dps {diag['derive_dps']} (de-fit min {defit:.1f} d); the detour transport in mpc at working dps "
          f"{dps + MINKOWSKI_GUARD + 25}, Taylor order {max(60, int(0.75 * dps) + 25)}]")
    with mp.workdps(30):
        print("    declared singular points (the step control keeps every step inside the distance to the nearest): "
              + ", ".join(f"{n} = {mp.nstr(z.real, 12)}" for n, z in minkowski_singular_points()))
    # ---- the routes ----
    y_up, d_up = minkowski_route(y0, xb, X, H, dps, entries, coef, ns, f"upper detour h = {H} (x + i0, the route of record)")
    y_lo, d_lo = minkowski_route(y0, xb, X, -H, dps, entries, coef, ns, f"lower detour h = -{H} (x - i0, the conjugate sheet)")
    y_up2, d_up2 = minkowski_route(y0, xb, X, H + 1, dps, entries, coef, ns, f"second upper route h = {H + 1} (route independence)")
    mp.dps = dps + 33
    fails = []
    # the values AS PRINTED (rounded to dps): the gate, the transport pair and the Euclidean comparisons read these -- the
    # digits the script certifies are the digits it prints (the record's convention: its prediction strings at dps); the
    # Schwarz and route controls below read the full working precision (they measure the engine)
    with mp.workdps(dps):
        y_up_p = [+v for v in y_up]
        y_lo_p = [+v for v in y_lo]
    sch = {f"({i},{K})": minkowski_digits(y_up[n], mp.conj(y_lo[n])) for n, (i, K) in enumerate(state)}
    sfl, smem, sident = minkowski_floor(sch)
    sbar = dps - 5
    print(f"\n  [Schwarz control] upper (x + i0) vs conj(lower (x - i0)): "
          + ("identical on every member (21/21)" if sfl is None else f"{sfl:.1f} d at {smem}; identical on {len(sident)}")
          + f" (expected identical: real seeds, real-rational connection, mirror routes; bar {sbar} d, RAISING)")
    if args.schwarz:
        for k, d in sch.items():
            print(f"      {k}: {'identical' if d is None else f'{d:.1f} d'}")
    if sfl is not None and sfl < sbar:
        fails.append(f"Schwarz control {sfl:.1f} d < {sbar} d at {smem}")
    # the route-independence control
    rt = {f"({i},{K})": minkowski_digits(y_up[n], y_up2[n]) for n, (i, K) in enumerate(state)}
    rfl, rmem, rident = minkowski_floor(rt)
    rbar = dps - 8
    print(f"  [route control] upper h = {H} vs upper h = {H + 1}: "
          + ("identical on every member" if rfl is None else f"{rfl:.1f} d at {rmem}; identical on {len(rident)}: {rident}")
          + f" (bar {rbar} d, RAISING)")
    if rfl is not None and rfl < rbar:
        fails.append(f"route control {rfl:.1f} d < {rbar} d at {rmem}")
    nontriv, triv = minkowski_print_values(y_up_p, state, dps, f"T(x + i0) at x = {X}" if not args.euclid_control else f"the detour values at x = {X}")
    mp.dps = dps + 33
    summary_digits = None
    pair_digits = None
    # ---- the Euclidean-limit control ----
    if args.euclid_control:
        print(f"\n  [Euclidean control] the served real-axis march to x = {X} (icc_top, the served step rule at working dps {dps}):")
        t0 = time.time()
        direct, _ = icc_top("eqmass", mpf(X.numerator) / X.denominator, dps=dps, verbose=True)
        print(f"    [{time.time() - t0:.1f} s]")
        mp.dps = dps + 33
        dd = {f"({i},{K})": minkowski_digits(y_up_p[n], mp.mpc(direct[(i, K)])) for n, (i, K) in enumerate(state)}
        dfl, dmem, dident = minkowski_floor(dd)
        dbar = dps - 12
        print(f"    upper detour vs the served direct march: "
              + ("identical on every member" if dfl is None else f"{dfl:.1f} d at {dmem}; identical on {len(dident)}: {dident}")
              + f" (both as printed at dps {dps}; the direct march runs at working dps {dps}; bar {dbar} d, RAISING)")
        if dfl is not None and dfl < dbar:
            fails.append(f"Euclidean control vs the direct march {dfl:.1f} d < {dbar} d at {dmem}")
        immax = max(fabs(v.imag) for v in y_up_p)
        print(f"    |Im| of the detour values at the Euclidean point: max {mp.nstr(immax, 3)} (a real point reached above the axis)")
        if X == _F(X_TARGET):
            top = DATA["eqmass"]["top_index"]
            obar = dps - 8
            for k in (0, 1):
                s = ORACLE[("eqmass", k)]
                d = minkowski_digits(y_up_p[idx[(top, k)]], mp.mpc(mpf(s)))
                print(f"    TOP eps^{k} at x = {X}: the detour value vs the stored AMFlow oracle string ({sig_digits(s)} d): "
                      f"{'identical' if d is None else f'{d:.1f} d'} (bar {obar} d, RAISING)")
                if d is not None and d < obar:
                    fails.append(f"Euclidean control vs the stored oracle eps^{k} {d:.1f} d < {obar} d")
        else:
            print(f"    (the stored oracle strings sit at x = {X_TARGET}; no stored value at x = {X})")
    # ---- the gate at X = 12 ----
    verdicts = {}
    if gate_point:
        bar = min(dps, MINKOWSKI_REFERENCE["certified_digits"]) - MINKOWSKI_MARGIN
        gate_vals = y_lo_p if args.mutate_sign else y_up_p
        glabel = "the LOWER detour (x - i0) compared AS IF physical [NEGATIVE CONTROL: the Im parts flip sign; the gate MUST fail by name on every component with a resolved imaginary part]" if args.mutate_sign else "T(x + i0), the upper detour"
        floors_all = []
        for tag in MINKOWSKI_REFERENCE["records"]:
            v, fl, mem = minkowski_gate(gate_vals, state, refs[tag], tag, ref_obj["records"][tag], dps, bar, glabel)
            verdicts[tag] = (v, fl, mem)
            floors_all += [fl[n]["digits"] for n in ("complex", "re", "im") if fl[n]["digits"] is not None]
        pair = ref_obj["gate_of_record"]["amflow_pair_floor"]
        print(f"\n  the AMFlow pair of record (goal 40 vs goal 60): {pair['digits']:.1f} d at {pair['member']} -> the record "
              f"certifies {MINKOWSKI_REFERENCE['certified_digits']} digits; the eps^1 layer (7 components (i,1)) is transported "
              f"but has no AMFlow record at this point (eps_order 4 stops at eps^0): pair-only, not gated")
        if floors_all:
            summary_digits = int(min(floors_all))
        if args.mutate or args.mutate_sign:
            failed = [t for t, (v, _, _) in verdicts.items() if v == "FAIL"]
            if args.mutate:
                ctag = MINKOWSKI_MUTATE["record"]
                comp = "(%d,%d)" % tuple(MINKOWSKI_MUTATE["component"])
                fired = verdicts[ctag][0] == "FAIL" and verdicts[ctag][2][comp]["verdict"] == "FAIL"
                print(f"\n  [NEGATIVE CONTROL --mutate] {ctag} {comp} Re perturbed by {MINKOWSKI_MUTATE['relative']}: gate "
                      f"{verdicts[ctag][0]}, the component reads {verdicts[ctag][2][comp]['re'][0]:.1f} d on Re -- "
                      f"{'CAUGHT (the expected FAIL by name; exit 1)' if fired else 'NOT CAUGHT (exit 6)'}")
            else:
                imf = {t: [k for k, m in verdicts[t][2].items() if "im" in m and not m["im"][1] and m["im"][0] < bar]
                       for t in verdicts}
                fired = all(verdicts[t][0] == "FAIL" and imf[t] for t in verdicts)
                print(f"\n  [NEGATIVE CONTROL --mutate-sign] the x - i0 sheet as if physical: gates "
                      f"{ {t: verdicts[t][0] for t in verdicts} }; Im below the bar on "
                      f"{ {t: imf[t] for t in imf} } -- {'CAUGHT (the expected FAIL by name on the Im parts; exit 1)' if fired else 'NOT CAUGHT (exit 6)'}")
            print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
            raise SystemExit(MINKOWSKI_RC["fail"] if fired else MINKOWSKI_RC["not_caught"])
        for t, (v, _, _) in verdicts.items():
            if v == "FAIL":
                fails.append(f"gate {t} FAIL")
    else:
        if not args.euclid_control:
            print(f"\n  NOT ESTABLISHED: no oracle at x = {X}; the vendored physical-region records sit at x = "
                  f"{MINKOWSKI_REFERENCE['x']} (the one Minkowski point gated); the values above are certified by the "
                  f"Schwarz and route controls and by a second working precision (--pair) only")
    # ---- the transport pair ----
    if args.pair:
        print(f"\n  [transport pair] the same upper detour at dps {dps + 30} (the seeds re-derived at dps {dps + 55}; the "
              f"pair member of the summary line):")
        seeds2, diag2, defit2, dwall2 = eqmass_derived_seeds(dps + 30)
        print(f"    [seeds derived at dps {diag2['derive_dps']} in {dwall2:.1f} s; de-fit min {defit2:.1f} d]")
        mp.dps = dps + 70
        state2, idx2, entries2, coef2, y02, xb2 = build_system("eqmass", seeds2)
        y_hi, d_hi = minkowski_route(y02, xb2, X, H, dps + 30, entries2, coef2, ns, f"upper detour h = {H} at dps {dps + 30}")
        with mp.workdps(dps + 30):
            y_hi_p = [+v for v in y_hi]
        mp.dps = dps + 63
        pr = {f"({i},{K})": minkowski_digits(y_up_p[n], y_hi_p[n]) for n, (i, K) in enumerate(state)}
        pfl, pmem, pident = minkowski_floor(pr)
        pbar = dps - 8
        print(f"    dps {dps} vs dps {dps + 30}: " + ("identical on every member" if pfl is None else f"{pfl:.1f} d at {pmem}; identical on {len(pident)}: {pident}")
              + f" (the values as printed at each dps; bar {pbar} d, RAISING)")
        pair_digits = dps if pfl is None else int(min(pfl, dps + 30))
        if pfl is not None and pfl < pbar:
            fails.append(f"transport pair {pfl:.1f} d < {pbar} d at {pmem}")
    # ---- the summary ----
    print()
    if gate_point:
        print(f"  {summary_digits} digits incl. Im (the AMFlow pair; the transport pair "
              f"{pair_digits if pair_digits is not None else 'not run: pass --pair'})")
    if fails:
        print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
        raise RuntimeError("--minkowski FAIL by name (below bar => nonzero exit): " + "; ".join(fails))
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print(f"MINKOWSKI VERDICT PASS: x = {X}{'' if args.euclid_control else ' + i0'}, dps {dps}; the value path of the "
          f"real-axis tiers untouched (the served seeds, system and step unit; the detour in a unit beside)")
    return y_up_p


# ---------------------------------------------------------------------------
# THE LANDING ARM AT x = -1/2 (--land) AND THE BAND -1/2 <= x < -1/4 (--band X)
# (2026-09-08).  x = -1/2 is the nearest singular point of the slice
# connection (A^(k) carries (2x+1)^(k+1): pole order k + 1 at grade k, not
# regular-singular in the served gauge -- no Frobenius landing is defined on
# it), yet the physical solution is analytic and single-valued there.  The
# landing arm carries the served seeds and graded 21-component system with
# the --minkowski arm's complex-step engine (minkowski_march /
# minkowski_taylor_coeffs = the served taylor_step's recursion at a complex
# expansion point, the certified tail bound per step) along the real axis to
# x = -1/2 - rho and once around the circle |x + 1/2| = rho; the value AT
# x = -1/2 is the Cauchy circle mean (the u^0 coefficient), |c_-1| and |c_-2|
# are the finiteness certificate, the closed-circuit return the
# single-valuedness certificate; the 14 components of the vendored AMFlow
# record at x = -1/2 (sha256-pinned below) are the gate.  The band arm is the
# second route: the written integral (58) at eps^0 in its dispersion form
# (mpmath-only; the served quad_certified), printed beside the transport
# route's complex detour around 2x + 1 = 0 (the served minkowski_route at
# H = 3/20, upper and lower).  See THE LANDING ARM in the docstring.
# ---------------------------------------------------------------------------
LANDING_REFERENCE = {
    "file": "vendor_row15_landing/icc_xm1o2_g120_out.json",
    "sha256": "d2aa636e183e3bd510ebef8fade8de67ab94884523c31ea6c48f9db03baaec84",
    "x": "-1/2",
    "point": {"p12sq": "-1/2", "p34sq": "-1/2", "p56sq": "-1", "msq": "1"},   # the record's numeric_values (its input file, not vendored: it carries a working-directory string; sha256 322646cc9fde0852...)
    "goal_digits": 120,
    "eps_order": 4,
    "components": 14,          # 7 masters x eps^-2..eps^0 by lead order (eps^1 not in the record)
    "printed_digits": 130,     # every midpoint carries 130 significant digits; the ball radii are at most 4.79e-130 (the largest, at component (2,0))
    "exit_code_mismatch": 3,   # the bundle's pin codes
    "exit_code_missing": 4,
}
LANDING_RC = {"fail": 1, "refused": 2, "pin_mismatch": 3, "missing": 4, "not_caught": 6}
LANDING_RHO = "1/16"          # the circle radius of record; --rho R, 0 < R <= LANDING_RHO_MAX (the next singular point, -1/4, is 1/4 away)
LANDING_RHO_MAX = "1/8"
LANDING_LEGS_MIN = 16         # --legs N: the sample points on the circle (default 1.7 dps + 20, the record's count)
LANDING_CERT_GUARD = 10       # |c_-1|, |c_-2|, |Im c_0| and the closed-circuit return must be below 10^-(dps - 10) relative to max(|c_0|, 1)
LANDING_MARGIN = 10           # the gate bar = min(dps, printed_digits) - MARGIN
LANDING_MUTATE = {"component": (4, 0), "relative": "1e-25"}   # the --mutate control's form (the record's, the top master at eps^0)
LANDING_RECORD = {
    "gate_floors": {
        "dps140": {
            "digits": 129.5,
            "member": "(1,0)",
            "pass": 14,
            "fail": 0,
            "no_record": 7,
            "identical_130": 10
        },
        "dps110": {
            "digits": 109.5,
            "member": "(3,0)"
        },
        "dps60": {
            "digits": 58.9,
            "member": "(3,-1)"
        }
    },
    "pair_floor": {
        "dps": [
            110,
            140
        ],
        "digits": 108.7,
        "member": "(3,1)",
        "identical_members": [
            "(0,-2)",
            "(3,-2)",
            "(6,-2)"
        ]
    },
    "two_radius_dps60_digits": 57.66,
    "planted_control_dps140": {
        "component": "(4,0)",
        "position": 60,
        "digits": 58.8,
        "verdict": "FAIL"
    },
    "circle_dps140_rho_1_16": {
        "legs": 258,
        "trunc_worst": "9.8703e-149",
        "cm1_abs_max": "5.1811e-141",
        "cm2_abs_max": "1.1128e-141",
        "closed_circuit_return": "3.1879e-139",
        "c0_imag_max": "1.8592e-138"
    },
    "circle_dps60": {
        "rho_1_16": {
            "legs": 122,
            "cm1_abs_max": "1.0747e-60",
            "cm2_abs_max": "3.2785e-62",
            "closed_circuit_return": "2.7784e-59"
        },
        "rho_1_32": {
            "legs": 122,
            "cm1_abs_max": "1.6848e-59",
            "cm2_abs_max": "3.1983e-61",
            "closed_circuit_return": "5.055e-58"
        }
    },
    "T_eps0_at_dps140": "0.63729940293564870663073724181819738020600371009363637575066960359632881267400103519439328502655051145430007800203509692007907000228122538177",
    "record_engine_walls": {
        "dps60_two_radii": "8:16.19",
        "dps110": "16:25.90",
        "dps140": "28:28.12",
        "note": "the record's own engine (a different implementation of the same construction; not this arm's walls)"
    },
    "frobenius_form": "REFUSED BY THE TOOL"
}
BAND_H = "3/20"               # the detour height of the record's band transport (above and below the letter 2x + 1 = 0)
BAND_DPS_DEFAULT = 45         # the integral's precision of record; the transport runs at dps + BAND_TRANSPORT_EXTRA
BAND_PAIR_STEP = 15           # the integral's two-precision pair: dps and dps + 15
BAND_TRANSPORT_EXTRA = 15
BAND_AFORM_DPS = 20           # the a-form cross-check (the direct fold in a): an independent assembly, low precision
BAND_AFORM_BAR = 15
BAND_MARGIN = 8               # cross-gate bar = min(the integral's pair floor, dps) - MARGIN
BAND_QUAD_GUARD = 2           # the outer quadrature is certified at 10^-(dps + 2) by the served quad_certified
BAND_RECORD = {
    "points": {
        "-1/2": {
            "integral58": {
                "dps": 45,
                "value": "0.63729940293564870663073724181819738020600371009364",
                "pair_digits": 43.7,
                "aform_digits": 31.3
            },
            "vs_landed_digits": 50.2,
            "vs_record_digits": 50.2
        },
        "-9/20": {
            "integral58": {
                "dps": 45,
                "value": "0.64019360772895954142011791640480359762019511048264",
                "pair_digits": 43.7,
                "aform_digits": 31.2,
                "radius_variation_digits": 43.9
            },
            "transport_detour": {
                "dps": 60,
                "value_4_0": "0.640193607728959541420117916404803597620195110482642854117593",
                "upper_vs_lower_floor": {
                    "digits": "identical (60) for 21 of 21 components",
                    "member": "all"
                },
                "steps_upper": 22,
                "trunc_worst_upper": "9.81318e-69"
            },
            "integral_vs_detour_digits": 50.4
        },
        "-3/10": {
            "integral58": {
                "dps": 45,
                "value": "0.64904979382577237649091468096982475999175693030605",
                "pair_digits": 43.7,
                "aform_digits": 31.4,
                "radius_variation_digits": 43.9
            },
            "transport_detour": {
                "dps": 60,
                "value_4_0": "0.649049793825772376490914680969824759991756930306048458560258",
                "upper_vs_lower_floor": {
                    "digits": "identical (60) for 21 of 21 components",
                    "member": "all"
                },
                "steps_upper": 40,
                "trunc_worst_upper": "9.81318e-69"
            },
            "integral_vs_detour_digits": 50.6
        }
    },
    "controls": {
        "-1": {
            "agree_digits": 63.1
        },
        "-2": {
            "agree_digits": 63.1
        }
    },
    "record_engine_walls": {
        "integral_five_points_dps30_45": "13:20.92",
        "detour_two_points_dps60": "12:13.26",
        "note": "the record's own engines (not this arm's walls)"
    }
}


def land_die(rc, msg):
    print(msg, flush=True)
    raise SystemExit(rc)


def land_load_reference(mutate=False):
    """the vendored x = -1/2 AMFlow record read through its sha256 pin (fail closed, by name): exit 4 when the file is
    missing beside this script, exit 3 on a pin mismatch.  The file is the AMFlow out itself, verbatim: its 7 results are
    asserted to be the served masters in the served order and their coefficients (order, [midpoint +/- radius], imaginary
    part 0) are parsed as strings.  Returns (the object, {(master, order): {mid, rad, nd}}); with mutate=True the (4,0)
    midpoint is perturbed in memory by the relative amount LANDING_MUTATE['relative'] (the file and its pin untouched)."""
    import hashlib
    p = os.path.join(HERE, LANDING_REFERENCE["file"])
    if not os.path.exists(p):
        land_die(LANDING_REFERENCE["exit_code_missing"],
                 f"icc-evaluate MISSING: pinned file {LANDING_REFERENCE['file']} is absent beside this file (the "
                 f"x = {LANDING_REFERENCE['x']} record); not serving --land / --band {LANDING_REFERENCE['x']}")
    got = hashlib.sha256(open(p, "rb").read()).hexdigest()
    if got != LANDING_REFERENCE["sha256"]:
        pos = next(i + 1 for i in range(64) if got[i] != LANDING_REFERENCE["sha256"][i])
        land_die(LANDING_REFERENCE["exit_code_mismatch"],
                 f"icc-evaluate REFUSED: {LANDING_REFERENCE['file']} integrity pin mismatch: sha256 {got} != pinned "
                 f"{LANDING_REFERENCE['sha256']} (first differing hex position {pos} of 64, 1-based); not serving "
                 f"--land / --band {LANDING_REFERENCE['x']}")
    o = json.load(open(p))
    assert o["mode"] == "solve_integrals" and o["options"]["d0"] == "2", "the record's mode / d0"
    assert len(o["result"]) == len(DATA["eqmass"]["masters"]), (len(o["result"]), "results")
    refs = {}
    for i, r in enumerate(o["result"]):
        assert r["integral"]["family"] == "icc" and r["integral"]["indices"] == DATA["eqmass"]["masters"][i], (i, r["integral"])
        for c in r["coefficients"]:
            K = int(c["order"])
            assert c["value"]["im"] == "0", (i, K, "a nonzero imaginary part in a Euclidean record")
            mid, rad = c["value"]["re"].strip("[]").split("+/-")
            mid, rad = mid.strip(), rad.strip()
            nd = len(mid.replace("-", "").replace(".", "").lstrip("0"))
            if mutate and (i, K) == tuple(LANDING_MUTATE["component"]):
                with mp.workdps(nd + 20):
                    mid = mp.nstr(mpf(mid) * (1 + mpf(LANDING_MUTATE["relative"])), nd)
            refs[(i, K)] = {"mid": mid, "rad": rad, "nd": nd}
    assert len(refs) == LANDING_REFERENCE["components"], (len(refs), "components")
    assert min(v["nd"] for v in refs.values()) == LANDING_REFERENCE["printed_digits"], "the printed digits of the record"
    print(f"  [pin] {LANDING_REFERENCE['file']} sha256 {got[:16]}... VERIFIED ({os.path.getsize(p)} bytes): the AMFlow record "
          f"at x = {LANDING_REFERENCE['x']} (p12sq = p34sq = {LANDING_REFERENCE['point']['p12sq']}, p56sq = "
          f"{LANDING_REFERENCE['point']['p56sq']}, msq = {LANDING_REFERENCE['point']['msq']}; goal {LANDING_REFERENCE['goal_digits']}, "
          f"eps_order {LANDING_REFERENCE['eps_order']}, working_pre {o['options']['working_pre']}), {len(refs)} real components as "
          f"[midpoint +/- radius] verbatim, {LANDING_REFERENCE['printed_digits']} printed digits each")
    if mutate:
        print(f"  [NEGATIVE CONTROL] the record's component {tuple(LANDING_MUTATE['component'])} midpoint perturbed in memory by a "
              f"relative {LANDING_MUTATE['relative']} (the file and its pin untouched): the gate MUST fail by name at that component")
    return o, refs


def land_circle(y_start, xs, rho, nlegs, sings, dps, wp, order, entries, coef, ns):
    """once around the circle |x - xs| = rho through nlegs equally spaced sample points x_j = xs + rho e^{i pi (1 + 2 j / N)},
    j = 0..N (x_0 = x_N = xs - rho, counter-clockwise), starting from the state y_start at x_0, by the --minkowski arm's
    complex-step engine: one Taylor expansion (minkowski_taylor_coeffs, order 'order') at the current sample point serves
    every following sample point whose step h = x_k - x_j lies within MINKOWSKI_RATIO x the distance to the nearest declared
    singular point AND passes the certified tail bound of minkowski_tail at |h| (threshold 10^-(dps+8) relative to the
    state); the expansion moves on from the last certified point.  Accumulates, over j = 0..N-1 with u_j = x_j - xs, the
    Cauchy sums c_0 = (1/N) sum y, c_-1 = (1/N) sum y u, c_-2 = (1/N) sum y u^2, c_1 = (1/N) sum y / u.  Returns (the sums
    as lists over the state, the state after the full circle at x_N, the diagnostics).  Refuses by name (RuntimeError ->
    exit 1) when no sample point can be certified from an expansion (a sample spacing the engine cannot step)."""
    pts = [mp.mpc(xs - rho)] + [xs + rho * mp.expjpi(1 + 2 * mpf(j) / nlegs) for j in range(1, nlegs)] + [mp.mpc(xs - rho)]
    c0 = [mp.mpc(0)] * ns
    cm1 = [mp.mpc(0)] * ns
    cm2 = [mp.mpc(0)] * ns
    c1 = [mp.mpc(0)] * ns

    def accumulate(j, yv):
        u = pts[j] - xs
        for m in range(ns):
            c0[m] += yv[m]
            cm1[m] += yv[m] * u
            cm2[m] += yv[m] * u * u
            c1[m] += yv[m] / u

    y = [mp.mpc(v) for v in y_start]
    accumulate(0, y)
    tiny = mpf(10) ** (-(4 * wp))
    diag = {"expansions": 0, "evaluations": 0, "trunc_worst": mpf(0), "order_used_max": 0, "points_per_expansion_max": 0}
    j = 0
    t0 = time.time()
    while j < nlegs:
        z = pts[j]
        hist = minkowski_taylor_coeffs(y, z, order, entries, coef, ns)
        diag["expansions"] += 1
        dsing = min(abs(z - s) for _, s in sings)
        k = j + 1
        advanced = 0
        yk = None
        while k <= nlegs:
            h = pts[k] - z
            hmag = abs(h)
            if hmag > mpf(MINKOWSKI_RATIO) * dsing:
                break
            used, bound, thresh, ynorm = minkowski_tail(hist, hmag, ns, wp, dps)
            if not (bound < thresh):
                break
            yk = minkowski_sum(hist, h, used, ns)
            diag["evaluations"] += 1
            trunc_rel = bound / max(ynorm, tiny)
            if trunc_rel > diag["trunc_worst"]:
                diag["trunc_worst"] = trunc_rel
            if used > diag["order_used_max"]:
                diag["order_used_max"] = used
            if k < nlegs:
                accumulate(k, yk)
            advanced += 1
            k += 1
        if advanced == 0:
            raise RuntimeError(
                f"--land circle: no sample point certified from the expansion at x_{j} = {mp.nstr(z, 8)} (sample spacing "
                f"{mp.nstr(abs(pts[j + 1] - z), 4)} vs the distance {mp.nstr(dsing, 6)} to the nearest declared singular point; "
                f"pass more --legs); refusing (rc 1)")
        if advanced > diag["points_per_expansion_max"]:
            diag["points_per_expansion_max"] = advanced
        y = yk
        j = k - 1
        if diag["expansions"] % max(1, nlegs // 8) == 1:
            print(f"      circle rho = {mp.nstr(rho, 6)}: sample point {j}/{nlegs} after {diag['expansions']} expansions, "
                  f"{time.time() - t0:.0f} s", flush=True)
    diag["wall_s"] = time.time() - t0
    sums = {"c0": [v / nlegs for v in c0], "cm1": [v / nlegs for v in cm1], "cm2": [v / nlegs for v in cm2],
            "c1": [v / nlegs for v in c1]}
    return sums, y, diag


def land_transport(dps, rho_q, nlegs, second_radius, label):
    """the landing at ONE working precision: the served seeds (eqmass_derived_seeds) and system (build_system), the real
    leg -1 -> -1/2 - rho by minkowski_march, the circle(s) by land_circle, the served-tier control at -1/2 - rho (icc_top),
    the certificates; returns a dict with the values as mpc at working precision dps + 33 and every figure."""
    from fractions import Fraction as _F
    seeds, diag, defit, dwall = eqmass_derived_seeds(dps)
    print_boundary_block("eqmass", dict(kind="derived", seeds=seeds, diag=diag, defit=defit, wall=dwall), spectral=False)
    mp.dps = dps + 40
    state, idx, entries, coef, y0, xb = build_system("eqmass", seeds)
    ns = len(state)
    wp = dps + MINKOWSKI_GUARD + 25
    order = max(60, int(0.75 * dps) + 25)
    print(f"    [eqmass: {ns}-component graded state (7 masters x eps^-2..eps^1), {len(entries)} couplings; seeds derived at dps "
          f"{diag['derive_dps']} (de-fit min {defit:.1f} d); the complex-step engine at working dps {wp}, Taylor order {order}]")
    out = {"dps": dps, "wp": wp, "order": order, "state": state, "idx": idx, "ns": ns}
    with mp.workdps(wp):
        xs = mpf(-1) / 2
        rho = mpf(rho_q.numerator) / rho_q.denominator
        sings = minkowski_singular_points()
        # the real leg: -1 -> -1/2 - rho on the real axis (a real segment in mpc arithmetic; the step control keeps every
        # step inside MINKOWSKI_RATIO x the distance to -1/2)
        dr = {"steps": 0, "trunc_worst": mpf(0), "min_hfrac": mpf(MINKOWSKI_RATIO)}
        t0 = time.time()
        y_r = minkowski_march([mp.mpc(v) for v in y0], mp.mpc(xb), mp.mpc(xs - rho), sings, dps, wp, order, entries, coef, ns, dr)
        dr["wall_s"] = time.time() - t0
        print(f"    [{label}: the real leg {mp.nstr(xb, 4)} -> {mp.nstr(xs - rho, 8)}: {dr['steps']} steps of order <= {order} "
              f"(used <= {dr.get('order_used_max', order)}); trunc_worst {mp.nstr(dr['trunc_worst'], 3)}; min step fraction "
              f"{mp.nstr(dr['min_hfrac'], 4)}; {dr['wall_s']:.1f} s]", flush=True)
        out["real_leg"] = dr
        out["y_real"] = y_r
        radii = [(rho_q, rho)] + ([(rho_q / 2, rho / 2)] if second_radius else [])
        circles = {}
        for rq, r in radii:
            if r == rho:
                y_c = y_r
            else:
                dq = {"steps": 0, "trunc_worst": mpf(0), "min_hfrac": mpf(MINKOWSKI_RATIO)}
                y_c = minkowski_march(y_r, mp.mpc(xs - rho), mp.mpc(xs - r), sings, dps, wp, order, entries, coef, ns, dq)
            sums, y_end, dc = land_circle(y_c, xs, r, nlegs, sings, dps, wp, order, entries, coef, ns)
            ref = max(max(abs(v) for v in sums["c0"]), mpf(1))
            cert = {
                "cm1_rel": max(abs(v) for v in sums["cm1"]) / ref,
                "cm2_rel": max(abs(v) for v in sums["cm2"]) / ref,
                "c0_imag_rel": max(fabs(v.imag) for v in sums["c0"]) / ref,
                "return_rel": max(abs(y_end[m] - y_c[m]) for m in range(ns)) / max(max(abs(v) for v in y_c), mpf(1)),
            }
            print(f"    [{label}: the circle |x + 1/2| = {rq}, N = {nlegs}: {dc['expansions']} expansions of order <= {order} "
                  f"(used <= {dc['order_used_max']}), {dc['evaluations']} certified series evaluations (<= "
                  f"{dc['points_per_expansion_max']} sample points per expansion); trunc_worst {mp.nstr(dc['trunc_worst'], 3)}; "
                  f"{dc['wall_s']:.1f} s]", flush=True)
            print(f"      certificates (relative to max(|c_0|, 1)): |c_-1| max {mp.nstr(cert['cm1_rel'], 3)}; |c_-2| max "
                  f"{mp.nstr(cert['cm2_rel'], 3)}; |Im c_0| max {mp.nstr(cert['c0_imag_rel'], 3)}; closed-circuit return "
                  f"{mp.nstr(cert['return_rel'], 3)} (each must be below 10^-{dps - LANDING_CERT_GUARD}: analytic and "
                  f"single-valued at x = -1/2 to working precision)", flush=True)
            circles[str(rq)] = {"sums": sums, "cert": cert, "diag": dc, "y_start": y_c, "y_end": y_end}
        out["circles"] = circles
        out["radii"] = [str(rq) for rq, _ in radii]
        out["values"] = circles[str(rho_q)]["sums"]["c0"]
        out["derivatives"] = circles[str(rho_q)]["sums"]["c1"]
    return out


def land_digits_real(a, b):
    """digits of agreement of the real parts (|a - b| relative to |b|, or to 1 when b = 0); None when identical."""
    ar, br = a.real, b.real          # mpf.real is the mpf itself; mpc.real its real part
    d = fabs(ar - br)
    if d == 0:
        return None
    ref = fabs(br)
    return float(-log10(d / (ref if ref != 0 else mpf(1))))


def land_gate(vals_p, state, refs, dps, bar, label):
    """the gate of the landed values (as printed at dps) against the vendored record: per component (master, order) the
    digits of agreement relative to |record|, 'identical (N)' below the record's printed resolution 10^-N; the floor with
    its member; every gated component must meet the bar (FAIL by name).  Returns (verdict, floor digits, floor member,
    members)."""
    mp.dps = max(dps + 20, max(r["nd"] for r in refs.values()) + 20)
    idx = {s: n for n, s in enumerate(state)}
    members = {}
    fails = []
    print(f"\n  {label} vs the record (AMFlow goal {LANDING_REFERENCE['goal_digits']}, eps_order {LANDING_REFERENCE['eps_order']}; "
          f"{len(refs)} components x {LANDING_REFERENCE['printed_digits']} printed digits); bar {bar:.1f} d = min(dps {dps}, "
          f"the record's printed {LANDING_REFERENCE['printed_digits']}) - {LANDING_MARGIN}")
    print(f"    {'component':<9} {'integral':<24} {'record d':>8} {'radius':>10} {'agreement':>12}  verdict")
    for (i, K), rec in sorted(refs.items()):
        if (i, K) not in idx:
            members[f"({i},{K})"] = {"verdict": "NO PREDICTION (component outside the landed state)"}
            continue
        v = vals_p[idx[(i, K)]]
        r = mpf(rec["mid"])
        nd = rec["nd"]
        refm = fabs(r) if r != 0 else mpf(1)
        d = fabs(v - r)
        if d == 0 or d < mpf(10) ** (-nd) * refm:
            dig, ident = float(nd), True
        else:
            dig, ident = float(-log10(d / refm)), False
        ok = dig >= bar
        members[f"({i},{K})"] = {"digits": dig, "identical": ident, "record_digits": nd, "verdict": "PASS" if ok else "FAIL"}
        if not ok:
            fails.append(f"({i},{K})")
        cell = f"={nd}" if ident else f"{dig:.1f}"
        print(f"    ({i},{K:+d})    {str(DATA['eqmass']['masters'][i]):<24} {nd:>8} {rec['rad']:>10} {cell:>12}  {'PASS' if ok else 'FAIL'}")
    for (i, K) in state:
        if (i, K) not in refs:
            members[f"({i},{K})"] = {"verdict": "NO RECORD (the eps^1 layer: not in the goal-120 record)"}
    fl, mem, ident = minkowski_floor({k: (None if m["identical"] else m["digits"]) for k, m in members.items() if "digits" in m})
    gated = [k for k, m in members.items() if "digits" in m]
    verdict = "PASS" if (gated and not fails) else "FAIL"
    print(f"    floor: " + ("identical (N) on every gated member" if fl is None else f"{fl:.1f} d at {mem}")
          + (f"; identical ({LANDING_REFERENCE['printed_digits']}) on {len(ident)}: {ident}" if ident else "")
          + f"; no record (the eps^1 layer) on {sum(1 for m in members.values() if m['verdict'].startswith('NO RECORD'))}")
    print(f"    [gate] {verdict} {len(gated) - len(fails)} pass / {len(fails)} fail of {len(gated)} gated"
          f"{' -- FAIL at ' + ', '.join(fails) if fails else ''} (bar {bar:.1f} d; below-bar RAISES, rc 1)")
    return verdict, fl, mem, members


def land_main(args):
    """--land driver: the refusals, the pin, the landing at dps (and at dps + 30 with --pair), the certificates and controls,
    the gate against the vendored record, the summary line and the exit code."""
    from fractions import Fraction as _F
    t_all = time.time()
    dps = args.dps if args.dps is not None else 60
    try:
        rho_q = _F(args.rho) if args.rho is not None else _F(LANDING_RHO)
    except (ValueError, ZeroDivisionError):
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --rho R must be an exact rational (got {args.rho!r})")
    if not (0 < rho_q <= _F(LANDING_RHO_MAX)):
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --rho R = {rho_q} is outside 0 < R <= {LANDING_RHO_MAX}: the circle "
                                        f"|x + 1/2| = R must stay well inside the distance 1/4 to the next singular point -1/4 "
                                        f"(the aliasing error of the circle mean is (4 R)^N)")
    nlegs = args.legs if args.legs is not None else int(1.7 * dps) + 20
    if nlegs < LANDING_LEGS_MIN:
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --legs N = {nlegs} < {LANDING_LEGS_MIN} (the default is 1.7 dps + 20)")
    if args.detour is not None or args.schwarz or args.mutate_sign:
        land_die(LANDING_RC["refused"], "icc-evaluate REFUSED: --detour, --schwarz and --mutate-sign belong to the --minkowski arm")
    if args.euclid_control:
        land_die(LANDING_RC["refused"], "icc-evaluate REFUSED: --euclid-control belongs to the --minkowski arm and to the --band arm "
                                        "(--band X --euclid-control with X < -1/2); the landing's own served-tier control runs on "
                                        "every --land")
    if args.mutate and dps < 40:
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --mutate bites only at dps >= 40 (the bar min(dps, "
                                        f"{LANDING_REFERENCE['printed_digits']}) - {LANDING_MARGIN} must exceed the 25 digits the "
                                        f"planted perturbation leaves); got dps {dps}")
    print("=" * 78)
    print(f"ICC equal-mass masters AT x = -1/2 (the letter 2x + 1 = 0) by the circle landing of the slice connection")
    print(f"(the real leg -1 -> -1/2 - {rho_q}, then once around |x + 1/2| = {rho_q} through {nlegs} sample points; the value = the Cauchy circle mean)")
    print("=" * 78)
    ref_obj, refs = land_load_reference(mutate=bool(args.mutate))   # the pin FIRST, before any computation
    fails = []
    L = land_transport(dps, rho_q, nlegs, args.second_radius, f"dps {dps}")
    state, idx, ns, wp = L["state"], L["idx"], L["ns"], L["wp"]
    mp.dps = wp
    cbar = mpf(10) ** (-(dps - LANDING_CERT_GUARD))
    for rq in L["radii"]:
        cert = L["circles"][rq]["cert"]
        for name, key in (("finiteness |c_-1|", "cm1_rel"), ("finiteness |c_-2|", "cm2_rel"), ("|Im c_0|", "c0_imag_rel"),
                          ("closed-circuit return", "return_rel")):
            if not (cert[key] < cbar):
                fails.append(f"{name} at rho = {rq}: {mp.nstr(cert[key], 3)} >= 10^-{dps - LANDING_CERT_GUARD}")
    # the served-tier control: the state at -1/2 - rho by the complex-step engine vs the served real-axis march
    xr = _F(-1, 2) - rho_q
    print(f"\n  [served-tier control] the served real-axis march to x = {xr} (icc_top, the served step rule at working dps {dps}):")
    t0 = time.time()
    direct, _ = icc_top("eqmass", mpf(xr.numerator) / xr.denominator, dps=dps, verbose=True)
    print(f"    [{time.time() - t0:.1f} s]")
    mp.dps = wp
    with mp.workdps(dps):
        y_real_p = [+v for v in L["y_real"]]
    dd = {f"({i},{K})": land_digits_real(y_real_p[n], direct[(i, K)]) for n, (i, K) in enumerate(state)}
    dfl, dmem, dident = minkowski_floor(dd)
    dbar = dps - 12
    print(f"    the complex-step engine vs the served direct march at x = {xr}: "
          + ("identical on every member" if dfl is None else f"{dfl:.1f} d at {dmem}; identical on {len(dident)}: {dident}")
          + f" (both as printed at dps {dps}; the direct march runs at working dps {dps}; bar {dbar} d, RAISING)")
    if dfl is not None and dfl < dbar:
        fails.append(f"served-tier control {dfl:.1f} d < {dbar} d at {dmem}")
    # the two-radius check
    if args.second_radius:
        a, b = L["circles"][L["radii"][0]]["sums"]["c0"], L["circles"][L["radii"][1]]["sums"]["c0"]
        tr = {f"({i},{K})": minkowski_digits(a[n], b[n]) for n, (i, K) in enumerate(state)}
        tfl, tmem, tident = minkowski_floor(tr)
        tbar = dps - 8
        print(f"  [two-radius check] the circle means at rho = {L['radii'][0]} vs rho = {L['radii'][1]}: "
              + ("identical on every member" if tfl is None else f"{tfl:.1f} d at {tmem}; identical on {len(tident)}")
              + f" (bar {tbar} d, RAISING)")
        if tfl is not None and tfl < tbar:
            fails.append(f"two-radius check {tfl:.1f} d < {tbar} d at {tmem}")
    # the values as printed (rounded to dps): the gate and the pair read these (the record's convention)
    with mp.workdps(dps):
        vals_p = [+v.real for v in L["values"]]
        der_p = [+v.real for v in L["derivatives"]]
    print(f"\n  T(-1/2): the 21 components (master, eps order) at dps {dps} (the Cauchy circle mean, real part)")
    mp.dps = dps
    top = DATA["eqmass"]["top_index"]
    for n, (i, K) in enumerate(state):
        print(f"    ({i},{K:+d}) {DATA['eqmass']['masters'][i]}  {mp.nstr(vals_p[n], dps)}")
    print(f"    the derivative dT/dx at x = -1/2 of the top master at eps^0 (c_1 of the circle): {mp.nstr(der_p[idx[(top, 0)]], dps)}")
    mp.dps = wp
    # the gate
    bar = min(dps, LANDING_REFERENCE["printed_digits"]) - LANDING_MARGIN
    verdict, gfl, gmem, members = land_gate(vals_p, state, refs, dps, bar, f"T(-1/2) at dps {dps}, as printed")
    rec = LANDING_RECORD["gate_floors"]
    print(f"    (the record's floors: dps 140 {rec['dps140']['digits']} d at {rec['dps140']['member']}; dps 110 "
          f"{rec['dps110']['digits']} d at {rec['dps110']['member']}; dps 60 {rec['dps60']['digits']} d at {rec['dps60']['member']})")
    if args.mutate:
        comp = "(%d,%d)" % tuple(LANDING_MUTATE["component"])
        fired = verdict == "FAIL" and members[comp]["verdict"] == "FAIL"
        print(f"\n  [NEGATIVE CONTROL --mutate] the record's {comp} midpoint perturbed by {LANDING_MUTATE['relative']}: gate {verdict}, "
              f"the component reads {members[comp]['digits']:.1f} d -- "
              f"{'CAUGHT (the expected FAIL by name; exit 1)' if fired else 'NOT CAUGHT (exit 6)'}")
        print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
        raise SystemExit(LANDING_RC["fail"] if fired else LANDING_RC["not_caught"])
    if verdict == "FAIL":
        fails.append("gate FAIL")
    summary_digits = LANDING_REFERENCE["printed_digits"] if gfl is None else int(gfl)
    pair_digits = None
    # the transport pair
    if args.pair:
        d2 = dps + 30
        n2 = int(1.7 * d2) + 20
        print(f"\n  [transport pair] the same landing at dps {d2} (seeds re-derived at dps {d2 + 25}; N = {n2}; the pair member of the summary line):")
        L2 = land_transport(d2, rho_q, n2, False, f"dps {d2}")
        mp.dps = L2["wp"]
        c2 = L2["circles"][str(rho_q)]["cert"]
        c2bar = mpf(10) ** (-(d2 - LANDING_CERT_GUARD))
        for name, key in (("finiteness |c_-1|", "cm1_rel"), ("finiteness |c_-2|", "cm2_rel"), ("|Im c_0|", "c0_imag_rel"),
                          ("closed-circuit return", "return_rel")):
            if not (c2[key] < c2bar):
                fails.append(f"pair member {name}: {mp.nstr(c2[key], 3)} >= 10^-{d2 - LANDING_CERT_GUARD}")
        with mp.workdps(d2):
            v2_p = [+v.real for v in L2["values"]]
        mp.dps = d2 + 33
        pr = {f"({i},{K})": minkowski_digits(vals_p[n], v2_p[n]) for n, (i, K) in enumerate(state)}
        pfl, pmem, pident = minkowski_floor(pr)
        pbar = dps - 8
        print(f"    dps {dps} vs dps {d2}: " + ("identical on every member" if pfl is None else f"{pfl:.1f} d at {pmem}; identical on {len(pident)}: {pident}")
              + f" (the values as printed at each dps; bar {pbar} d, RAISING; the record's pair dps 110 vs 140: "
              f"{LANDING_RECORD['pair_floor']['digits']} d at {LANDING_RECORD['pair_floor']['member']})")
        pair_digits = dps if pfl is None else int(min(pfl, d2))
        if pfl is not None and pfl < pbar:
            fails.append(f"transport pair {pfl:.1f} d < {pbar} d at {pmem}")
    print(f"\n  the eps^1 layer (the 7 components (i,1)) is landed with the same certificates but has no record at this point "
          f"(eps_order 4 stops at eps^0): pair-only, not gated")
    print()
    print(f"  {summary_digits} digits (the goal-120 record, {len(refs)} of {ns} components; the transport pair "
          f"{pair_digits if pair_digits is not None else 'not run: pass --pair'})")
    if fails:
        print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
        raise RuntimeError("--land FAIL by name (below bar => nonzero exit): " + "; ".join(fails))
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print(f"LANDING VERDICT PASS: x = -1/2, dps {dps}, rho {rho_q}, N {nlegs}; the value path of the real-axis tiers untouched "
          f"(the served seeds, system and step unit; the complex-step engine and the circle in units beside)")
    return vals_p


def band_kernel(x):
    """K(s; x) = int_Delta d^2 alpha F^-2 at the caller's working precision, the effective triangle of the written integral
    (58) on the slice (w = p56^2 = -1, equal masses): with t = alpha1 + alpha2 at fixed alpha2, F = x t^2 + (1 - s + alpha2
    - x) t + (s - alpha2^2), so the t-fold is elementary (rational + one logarithm, written in the Vieta-stable form: the
    discriminant D = s^2 - 2 s (b0 + 2x) + b0^2 + 4 x alpha2^2 and the logarithm's argument without the cancelling sum at
    large s; Q(1) = 1 + alpha2 - alpha2^2 is s-free), and the alpha2-fold is one tanh-sinh.  Returns the closure K(s)."""
    x = mpf(x)

    def G(s, a2):
        a = x
        b0 = 1 + a2 - x
        b = b0 - s
        D = s * s - 2 * s * (b0 + 2 * x) + (b0 * b0 + 4 * x * a2 * a2)
        sD = sqrt(D)
        Q1 = 1 + a2 - a2 * a2
        Qa = s * (1 - a2) + a2 * (1 - x * (1 - a2))
        l4aQ1 = log(4 * fabs(a) * Q1)
        l4aQa = log(4 * fabs(a) * Qa)

        def Fprim(t, Q, l4aQ):
            m = 2 * a * t + b
            if m < 0:
                logterm = 2 * log(sD - m) - l4aQ
            else:
                logterm = l4aQ - 2 * log(m + sD)
            return -m / (D * Q) - (2 * a / (D * sD)) * logterm
        return Fprim(mpf(1), Q1, l4aQ1) - Fprim(a2, Qa, l4aQa)

    def K(s):
        s = mpf(s)
        return quad(lambda a2: G(s, a2), [0, 1], method="tanh-sinh")
    return K


def band_integral58(xq, dps):
    """the written integral (58) at eps^0 in its dispersion form (xq the point as an exact rational, converted to mpf INSIDE the
    working precision: the r1 units converted it at the ambient 15 digits and the band pilot read 18 d against the record), T0(x) = int_4^inf ds rho(s) K(s; x) with rho(s) =
    2 / sqrt(s (s - 4)) (the two-dimensional equal-mass bubble spectral density), the threshold turn-on removed by
    s = 4 + u^2 (rho ds = 4 du / sqrt(4 + u^2)): the outer fold int_0^inf 4 / sqrt(4 + u^2) K(4 + u^2; x) du is one
    tanh-sinh on [0, inf) certified fail-closed by the served quad_certified (the engine's estimate below 10^-(dps + 2),
    maxdegree doubling, RuntimeError at the cap), at working precision dps + 10.  Returns (value at dps + 10, estimate)."""
    with mp.workdps(dps + 10):
        x = mpf(xq.numerator) / xq.denominator
        K = band_kernel(x)
        f = lambda u: 4 / sqrt(4 + u * u) * K(4 + u * u)
        v, est = blib.quad_certified(f, [0, mp.inf], dps + BAND_QUAD_GUARD, name=f"band integral (58) at x = {xq}, dps {dps}")
        return +v, est


def band_aform(xq, dps):
    """the a-form of the same integral, T0(x) = 2 int_0^(1/2) da / (a (1 - a)) K(1 / (a (1 - a)); x): an independent
    assembly of the written integral (the direct fold in a, no dispersion variable), at low precision (the cross-check)."""
    with mp.workdps(dps + 10):
        x = mpf(xq.numerator) / xq.denominator
        K = band_kernel(x)
        f = lambda a: K(1 / (a * (1 - a))) / (a * (1 - a))
        return +(2 * quad(f, [0, mpf(1) / 2], method="tanh-sinh"))


def band_main(args):
    """--band X driver: the refusals, the integral (58) at dps and dps + 15 with the a-form, the transport route's two
    detours (or, at X = -1/2, the record gate; or, with --euclid-control, the served real-axis march), the cross-gate,
    the exit code."""
    from fractions import Fraction as _F
    t_all = time.time()
    try:
        X = _F(args.band.strip())
    except (ValueError, ZeroDivisionError):
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --band X must be an exact rational (got {args.band!r})")
    dps = args.dps if args.dps is not None else BAND_DPS_DEFAULT
    if args.detour is not None or args.schwarz or args.mutate_sign or args.pair or args.second_radius or args.rho is not None or args.legs is not None:
        land_die(LANDING_RC["refused"], "icc-evaluate REFUSED: --detour, --schwarz, --mutate-sign and --pair belong to the --minkowski "
                                        "arm (--pair also to --land); --rho, --legs and --second-radius to the --land arm; the band's "
                                        "two-precision pair is built in")
    if args.euclid_control:
        if not (X < _F(-1, 2)):
            land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --band X --euclid-control runs the written integral at a Euclidean "
                                            f"point X < -1/2 and compares it with the served real-axis march (got X = {X}); the band "
                                            f"-1/2 <= X < -1/4 is --band X without it")
    elif not (_F(-1, 2) <= X < _F(-1, 4)):
        if X < _F(-1, 2):
            land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --band X = {X} is on the Euclidean axis x < -1/2: the served real-axis "
                                            f"tier (--point {float(X)}); the written integral there is the control form --band X "
                                            f"--euclid-control")
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --band X = {X} is not in the band -1/2 <= x < -1/4: the point -1/4 "
                                        f"(the connection's second real singular point, local exponents 0 and 1/2 at eps^0) and "
                                        f"-1/4 < x <= 0 are not served by any arm (the written integral is stated for x < -1/4); the "
                                        f"Minkowski region x > 0 is --minkowski X")
    if args.mutate and X != _F(-1, 2):
        land_die(LANDING_RC["refused"], f"icc-evaluate REFUSED: --mutate exercises the record gate at X = -1/2 (pass --band=-1/2 --mutate)")
    at_record = (not args.euclid_control) and X == _F(-1, 2)
    print("=" * 78)
    if args.euclid_control:
        print(f"ICC top master T(x) at eps^0 at the Euclidean point x = {X} by the written integral (58) (the control form):")
        print("the dispersion form of the integral vs the served real-axis march and the stored strings")
    else:
        print(f"ICC top master T(x) at eps^0 in the band at x = {X} by TWO routes: the written integral (58) in its dispersion form")
        print(f"and the slice connection's complex detour around the letter 2x + 1 = 0 (H = {BAND_H}, above and below)" if not at_record
              else f"gated against the vendored AMFlow record at x = -1/2 (the transport value AT -1/2 is the --land arm)")
    print("=" * 78)
    refs = None
    if at_record:
        _, refs = land_load_reference(mutate=bool(args.mutate))   # the pin FIRST
    fails = []
    # ---- route 2: the written integral at dps and dps + 15 ----
    dps2 = dps + BAND_PAIR_STEP
    vals = {}
    for d in (dps, dps2):
        t0 = time.time()
        v, est = band_integral58(X, d)
        vals[d] = v
        with mp.workdps(d + 10):
            print(f"  [integral (58), dispersion form, dps {d}: {mp.nstr(v, d + 5)}; engine estimate {mp.nstr(est, 3)} < 10^-{d + BAND_QUAD_GUARD} "
                  f"(certified); {time.time() - t0:.1f} s]", flush=True)
    mp.dps = dps2 + 20
    pfl = minkowski_digits(vals[dps], vals[dps2])
    pair_digits = dps if pfl is None else min(pfl, dps + 5)
    print(f"  the two-precision pair dps {dps} vs dps {dps2}: " + ("identical" if pfl is None else f"{pfl:.1f} d")
          + f" -> the integral certifies {pair_digits:.1f} d (capped at dps + 5)")
    t0 = time.time()
    va = band_aform(X, BAND_AFORM_DPS)
    mp.dps = dps2 + 20
    dA = minkowski_digits(va, vals[dps2])
    print(f"  the a-form at dps {BAND_AFORM_DPS} (the direct fold in a, an independent assembly): {mp.nstr(va, BAND_AFORM_DPS + 5)}; "
          f"vs the dispersion form " + ("identical" if dA is None else f"{dA:.1f} d") + f" (bar {BAND_AFORM_BAR} d, RAISING; {time.time() - t0:.1f} s)")
    if dA is not None and dA < BAND_AFORM_BAR:
        fails.append(f"a-form cross-check {dA:.1f} d < {BAND_AFORM_BAR} d")
    with mp.workdps(dps):
        v_p = +vals[dps]
    bar = min(pair_digits, dps) - BAND_MARGIN
    top = DATA["eqmass"]["top_index"]
    rec = BAND_RECORD["points"].get(str(X))
    # ---- the second route ----
    if at_record:
        r = refs[(top, 0)]
        mp.dps = r["nd"] + 20
        d = land_digits_real(v_p, mpf(r["mid"]))
        print(f"\n  the integral (58) at x = -1/2 vs the record's ({top},0) midpoint ({r['nd']} d, radius {r['rad']}): "
              + ("identical" if d is None else f"{d:.1f} d") + f" (bar {bar:.1f} d = min(the integral's pair floor, dps) - {BAND_MARGIN}, RAISING"
              + (f"; the record's route-vs-route figure at dps {rec['integral58']['dps']}: {rec['vs_record_digits']} d)" if rec else ")"))
        if args.mutate:
            fired = d is not None and d < bar
            print(f"\n  [NEGATIVE CONTROL --mutate] the record's ({top},0) midpoint perturbed by {LANDING_MUTATE['relative']}: the comparison reads "
                  f"{'identical' if d is None else f'{d:.1f} d'} vs bar {bar:.1f} -- {'CAUGHT (the expected FAIL by name; exit 1)' if fired else 'NOT CAUGHT (exit 6)'}")
            print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
            raise SystemExit(LANDING_RC["fail"] if fired else LANDING_RC["not_caught"])
        if d is not None and d < bar:
            fails.append(f"integral vs the record {d:.1f} d < {bar:.1f} d")
    elif args.euclid_control:
        print(f"\n  [Euclidean control] the served real-axis march to x = {X} (icc_top, the served step rule at working dps {dps}):")
        t0 = time.time()
        with mp.workdps(dps + 20):
            xm = mpf(X.numerator) / X.denominator
        direct, _ = icc_top("eqmass", xm, dps=dps, verbose=True)
        print(f"    [{time.time() - t0:.1f} s]")
        mp.dps = dps2 + 20
        d = minkowski_digits(v_p, direct[(top, 0)])
        print(f"    the integral (58) vs the served march, the top master at eps^0: " + ("identical" if d is None else f"{d:.1f} d")
              + f" (both as printed at dps {dps}; bar {bar:.1f} d, RAISING)")
        if d is not None and d < bar:
            fails.append(f"integral vs the served march {d:.1f} d < {bar:.1f} d")
        stored = None
        if X == _F(-1):
            stored = (DATA["eqmass"]["boundary"][str(top)]["0"], "the stored x = -1 string of the top master")
        elif X == _F(X_TARGET):
            stored = (ORACLE[("eqmass", 0)], "the stored AMFlow oracle string at x = -2")
        if stored:
            mp.dps = sig_digits(stored[0]) + 20
            ds = minkowski_digits(v_p, mpf(stored[0]))
            print(f"    the integral (58) vs {stored[1]} ({sig_digits(stored[0])} d): " + ("identical" if ds is None else f"{ds:.1f} d")
                  + f" (bar {bar:.1f} d, RAISING" + (f"; the record's control figure: {BAND_RECORD['controls'][str(X)]['agree_digits']} d)" if str(X) in BAND_RECORD["controls"] else ")"))
            if ds is not None and ds < bar:
                fails.append(f"integral vs {stored[1]} {ds:.1f} d < {bar:.1f} d")
    else:
        dt = dps + BAND_TRANSPORT_EXTRA
        H = _F(BAND_H)
        print(f"\n  [transport route] the slice connection carried into the band at dps {dt}: the served seeds and graded system along "
              f"-1 -> -1 + {H}i -> {X} + {H}i -> {X} (above the letter 2x + 1 = 0) and along the mirror route below it")
        seeds, diag, defit, dwall = eqmass_derived_seeds(dt)
        print_boundary_block("eqmass", dict(kind="derived", seeds=seeds, diag=diag, defit=defit, wall=dwall), spectral=False)
        mp.dps = dt + 40
        state, idx, entries, coef, y0, xb = build_system("eqmass", seeds)
        ns = len(state)
        y_up, d_up = minkowski_route(y0, xb, X, H, dt, entries, coef, ns, f"upper detour h = {H} (above 2x + 1 = 0)")
        y_lo, d_lo = minkowski_route(y0, xb, X, -H, dt, entries, coef, ns, f"lower detour h = -{H} (below 2x + 1 = 0)")
        mp.dps = dt + 33
        with mp.workdps(dt):
            y_up_p = [+v for v in y_up]
        sv = {f"({i},{K})": minkowski_digits(y_up[n], y_lo[n]) for n, (i, K) in enumerate(state)}
        sfl, smem, sident = minkowski_floor(sv)
        sbar = dt - 8
        print(f"    [single-valuedness] the upper vs the lower detour: " + ("identical on every member" if sfl is None else f"{sfl:.1f} d at {smem}; identical on {len(sident)}")
              + f" (no monodromy around 2x + 1 = 0: the solution is single-valued at -1/2; bar {sbar} d, RAISING"
              + (f"; the record's floor at dps {rec['transport_detour']['dps']}: {rec['transport_detour']['upper_vs_lower_floor']['digits']})" if rec else ")"))
        if sfl is not None and sfl < sbar:
            fails.append(f"single-valuedness {sfl:.1f} d < {sbar} d at {smem}")
        immax = max(fabs(v.imag) for v in y_up_p)
        print(f"    |Im| of the detoured values at the real point x = {X}: max {mp.nstr(immax, 3)}")
        print(f"\n  T({X}): the 21 components (master, eps order) at dps {dt} by the transport route (real part)")
        mp.dps = dt
        for n, (i, K) in enumerate(state):
            print(f"    ({i},{K:+d}) {DATA['eqmass']['masters'][i]}  {mp.nstr(y_up_p[n].real, dt)}")
        mp.dps = dt + 33
        d = land_digits_real(y_up_p[idx[(top, 0)]], v_p)
        print(f"\n  [cross-gate] the top master at eps^0: the transport route (dps {dt}) vs the written integral (58) (dps {dps}): "
              + ("identical" if d is None else f"{d:.1f} d") + f" (bar {bar:.1f} d = min(the integral's pair floor, dps) - {BAND_MARGIN}, RAISING"
              + (f"; the record's figure: {rec['integral_vs_detour_digits']} d)" if rec else ")"))
        if d is not None and d < bar:
            fails.append(f"cross-gate {d:.1f} d < {bar:.1f} d")
        print(f"  NOT ESTABLISHED: no AMFlow value of record exists inside the band; the two routes cross-gate each other, the "
              f"integral's own two-precision pair ({pair_digits:.1f} d) capping the comparison")
    if fails:
        print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
        raise RuntimeError("--band FAIL by name (below bar => nonzero exit): " + "; ".join(fails))
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print(f"BAND VERDICT PASS: x = {X}, the integral at dps {dps} / {dps2}" + ("" if (at_record or args.euclid_control) else f", the transport at dps {dps + BAND_TRANSPORT_EXTRA}")
          + "; the value path of the real-axis tiers untouched")
    return v_p


# ---------------------------------------------------------------------------
# THE ONE-FOLD FAST PATH (2026-09-11): --onefold X [--dps N] [--config eqmass|generic] [--mutate]
# The eps^0 top master written through the scoop's spectral mass (see THE ONE-FOLD FAST PATH in the docstring).
# New units only: nothing above calls them, the value path of every served tier is untouched.
# ---------------------------------------------------------------------------
ONEFOLD_DPS_DEFAULT = 60          # the arm's precision by default; the self-check member runs at dps + ONEFOLD_PAIR_STEP (60 / 90)
ONEFOLD_PAIR_STEP = 30
ONEFOLD_QUAD_GUARD = 2            # the outer s-fold certified at 10^-(dps + 2) by the served quad_certified (the --band arm's guard)
ONEFOLD_MARGIN = 8                # every bar of the arm = (the count it is compared against) - 8
ONEFOLD_MUTATE_DIGIT = 20         # --mutate: the stored comparison string perturbed at its 20th significant digit (mutate_digit)
ONEFOLD_DPS_MIN = 15
ONEFOLD_MUTATE_DPS_MIN = 30       # the control bites when the bar exceeds the 19 digits the planted digit leaves
ONEFOLD_RC = {"fail": 1, "refused": 2, "not_caught": 6}
ONEFOLD_MASSES = {"eqmass": (1, 1, 1, 1), "generic": (1, 2, 3, 5)}   # squared masses (m1, m2 | m3, m4): the two cone lines | the scoop pair
ONEFOLD_BREAKS = (0, 1, 4, 16)    # the t-breakpoints of the outer fold, s = s0 + t^2 (the reference implementation's)
ONEFOLD_P56 = -1                  # the slice: p56^2 = -1


def onefold_die(rc, msg):
    print(msg, flush=True)
    raise SystemExit(rc)


def onefold_extra(*vals):
    """guard digits for the closed-form bubble at a large spectral mass (its two logarithms cancel): 2 log10(the
    largest argument) + 12, the reference implementation's rule."""
    m = max([fabs(mpf(v)) for v in vals] + [mpf(1)])
    return int(2 * log10(m)) + 12


def onefold_bubble(p2, ma2, mb2):
    """the d = 2 one-loop bubble I2(p^2; ma^2, mb^2) = int_0^1 dal / (al ma^2 + (1 - al) mb^2 - al (1 - al) p^2) in
    closed form: partial fractions over the two roots a1, a2 of the quadratic A al^2 + B al + C (A = p^2, B = ma^2 -
    mb^2 - p^2, C = mb^2), I2 = [ln((1 - a1) / (-a1)) - ln((1 - a2) / (-a2))] / (A (a1 - a2)).  Below threshold the
    value is real; between the pseudo-threshold and the threshold the roots are a complex-conjugate pair, the two
    logarithms conjugate and the result is complex-typed with a cancelling imaginary part.  Evaluated at guard digits
    (onefold_extra, plus -log10 |discriminant| when the roots nearly coincide); the coincident-root case exactly
    (int_0^1 dal / (A (al - a0)^2) = -1 / (A a0 (1 - a0)))."""
    with mp.extradps(onefold_extra(p2, ma2, mb2)):
        A = mpf(p2)
        B = mpf(ma2) - mpf(mb2) - A
        C = mpf(mb2)
        if A == 0:
            return +(log((B + C) / C) / B) if B != 0 else +(1 / C)
        disc = B * B - 4 * A * C                    # = lambda(p^2, ma^2, mb^2)
        if disc == 0:
            a0 = -B / (2 * A)
            return +(-1 / (A * a0 * (1 - a0)))
        guard = 0 if fabs(disc) >= 1 else int(-log10(fabs(disc))) + 5
    with mp.extradps(onefold_extra(p2, ma2, mb2) + guard):
        A = mpf(p2)
        B = mpf(ma2) - mpf(mb2) - A
        C = mpf(mb2)
        sq = sqrt(B * B - 4 * A * C)                # imaginary between the pseudo-threshold and the threshold
        a1 = (-B + sq) / (2 * A)
        a2 = (-B - sq) / (2 * A)
        r = (log((1 - a1) / (-a1)) - log((1 - a2) / (-a2))) / (A * (a1 - a2))
    return +r


def onefold_cayley(m1, m2, m3, p12, p23, p13):
    """the modified Cayley matrix Y of a one-loop triangle with squared line masses (m1, m2, m3); p_ij^2 the
    invariant at the vertex joining lines i and j (F = alpha^T Y alpha / 2 on the simplex)."""
    return mp.matrix([[2 * m1, m1 + m2 - p12, m1 + m3 - p13],
                      [m1 + m2 - p12, 2 * m2, m2 + m3 - p23],
                      [m1 + m3 - p13, m2 + m3 - p23, 2 * m3]])


def onefold_triangle(m1, m2, m3, p12, p23, p13):
    """the d = 2 one-loop triangle int_simplex d^2 alpha / F^2 reduced EXACTLY to its three d = 2 bubbles:
    sum_i b_i I2^(i) with b = Y^{-1} (1, 1, 1)^T -- removing line i leaves the bubble of the other two lines at the
    invariant of their common vertex (line 1 removed: I2(p23; m2, m3), line 2: I2(p13; m1, m3), line 3: I2(p12;
    m1, m2))."""
    with mp.extradps(onefold_extra(m1, m2, m3, p12, p23, p13)):
        Y = onefold_cayley(mpf(m1), mpf(m2), mpf(m3), mpf(p12), mpf(p23), mpf(p13))
        b = mp.lu_solve(Y, mp.matrix([1, 1, 1]))
        r = (b[0] * onefold_bubble(p23, m2, m3) + b[1] * onefold_bubble(p13, m1, m3)
             + b[2] * onefold_bubble(p12, m1, m2))
    return +r


def onefold_threshold(masses):
    """the lowest normal threshold of the cone in x on the slice p12^2 = p34^2 = x at squared masses (m1, m2, m3,
    m4): a cone line and the scoop pair cut together, (sqrt m_i + sqrt m3 + sqrt m4)^2 for the lighter cone line i
    (9 at equal mass); at and above it the real one-fold form is not served (an inner bubble reaches its threshold)."""
    m1, m2, m3, m4 = [mpf(m) for m in masses]
    return (sqrt(min(m1, m2)) + sqrt(m3) + sqrt(m4)) ** 2


def onefold_spectral(xq, masses, dps):
    """T(x) at eps^0 by the one-fold spectral form at squared masses (m1, m2, m3, m4): the scoop bubble (m3, m4) as
    a spectral propagator of squared mass s on [s0, inf), s0 = (sqrt m3 + sqrt m4)^2, density 2 / sqrt(lambda(s, m3,
    m4)), against the d = 2 triangle (m1, m2, s) at the invariants p56^2 (vertex 1-2), x (vertex 2-s), x (vertex 1-s)
    reduced to bubbles (onefold_triangle):  T(x) = 2 int_{s0}^inf ds / sqrt(lambda(s, m3, m4)) Tri(m1, m2, s; p56^2,
    x, x).  The threshold turn-on is removed by s = s0 + t^2 (ds / sqrt(lambda) = dt / sqrt(4 sqrt(m3 m4) + t^2)); the
    t-fold on [0, inf) with the breakpoints ONEFOLD_BREAKS is one tanh-sinh certified fail-closed by the served
    quad_certified at 10^-(dps + 2), working precision dps + 10.  xq the point as an exact rational (converted
    inside the working precision).  Returns (value, engine estimate)."""
    with mp.workdps(dps + 10):
        m1, m2, m3, m4 = [mpf(m) for m in masses]
        x = mpf(xq.numerator) / xq.denominator
        w = mpf(ONEFOLD_P56)
        s0 = (sqrt(m3) + sqrt(m4)) ** 2
        g = 4 * sqrt(m3 * m4)

        def f(t):
            s = s0 + t * t
            return 2 / sqrt(g + t * t) * onefold_triangle(m1, m2, s, w, x, x)
        v, est = blib.quad_certified(f, [mpf(b) for b in ONEFOLD_BREAKS] + [mp.inf], dps + ONEFOLD_QUAD_GUARD,
                                     name=f"one-fold spectral form at x = {xq}, squared masses {masses}, dps {dps}")
        return +(2 * v), est


def onefold_display(xq, dps):
    """T(x) at eps^0, equal mass, by the display form of the accompanying text (the one-fold integral of logarithms):
        T(x) = 2 int_4^inf ds / sqrt(s (s - 4)) [2 (c - 2 s) B(s; x) + (2 c - 5) Tri0] / (2 c^2 - 10 s),  c = s + 1 - x,
        B(s; x) = int_0^1 da / (a + s (1 - a) - x a (1 - a))   (= the d = 2 bubble of squared masses 1 and s at p^2 = x),
        Tri0 = 4 ln(phi) / sqrt 5   (= the d = 2 bubble at p56^2 = -1),
    with the same map s = 4 + t^2 (2 ds / sqrt(s (s - 4)) = 2 dt / sqrt(4 + t^2)) and the same certification as
    onefold_spectral.  The zeros of 2 c^2 - 10 s are the cone's Landau points s_pm(x) = ((3 + 2 x) pm sqrt 5 sqrt(4 x
    + 1)) / 2: complex for x < -1/4, real and below s = 4 for -1/4 <= x < 5 - 2 sqrt 5, on the contour above it, where
    the numerator vanishes with the denominator (a removable point of the integrand).  Returns (value, engine
    estimate)."""
    with mp.workdps(dps + 10):
        x = mpf(xq.numerator) / xq.denominator
        tri0 = onefold_bubble(ONEFOLD_P56, 1, 1)

        def f(t):
            s = 4 + t * t
            c = s + 1 - x
            return 2 / sqrt(4 + t * t) * (2 * (c - 2 * s) * onefold_bubble(x, 1, s) + (2 * c - 5) * tri0) / (2 * c * c - 10 * s)
        v, est = blib.quad_certified(f, [mpf(b) for b in ONEFOLD_BREAKS] + [mp.inf], dps + ONEFOLD_QUAD_GUARD,
                                     name=f"one-fold display form at x = {xq}, dps {dps}")
        return +(2 * v), est


def onefold_real(v):
    """(the real value, the imaginary residue |Im| / max(|Re|, 1)) of a one-fold result: the closed-form bubbles are
    complex-typed between a pseudo-threshold and the threshold and their imaginary parts cancel pairwise."""
    if isinstance(v, mp.mpc):
        return +v.real, fabs(v.imag) / max(fabs(v.real), mpf(1))
    return +v, mpf(0)


def onefold_main(args):
    """--onefold X driver: the refusals; the value at dps and at dps + ONEFOLD_PAIR_STEP (the two-precision
    self-check) by the display form at equal mass / the spectral form at the generic masses; at equal mass the
    second assembly (the spectral form beside the display form) and Tri0 vs its closed form; at X in {-1, -2} the
    comparison with the stored strings (the x = -1 string of the top master in icc-transport-data.json; the x = -2
    AMFlow oracle string ORACLE); the --mutate control; the exit code."""
    from fractions import Fraction as _F
    t_all = time.time()
    raw = args.onefold.strip()
    try:
        X = _F(raw)
    except (ValueError, ZeroDivisionError):
        onefold_die(ONEFOLD_RC["refused"], f"icc-evaluate REFUSED: --onefold X must be an exact rational or a decimal (got {raw!r})")
    cfg = args.config if args.config is not None else "eqmass"
    if cfg == "both":
        onefold_die(ONEFOLD_RC["refused"], "icc-evaluate REFUSED: --onefold serves one configuration per run (--config eqmass or --config generic)")
    if (args.detour is not None or args.schwarz or args.mutate_sign or args.pair or args.second_radius or args.rho is not None
            or args.legs is not None or args.euclid_control or args.land or args.band is not None or args.minkowski is not None
            or args.point is not None or args.full or args.double or args.masses is not None or args.cached
            or args.boundary_recompute is not None or args.check or args.g1_dps is not None or args.g1_mutate
            or args.mutate_xm3 or args.holdout_gate or args.mutate_seed):
        onefold_die(ONEFOLD_RC["refused"], "icc-evaluate REFUSED: --onefold X takes --dps, --config eqmass|generic and --mutate only; the "
                                           "options of the transport tiers (--point, --full, --double, --masses, ...) and of the --minkowski / "
                                           "--land / --band / --offslice arms belong to those (the one-fold self-check pair dps / dps + "
                                           f"{ONEFOLD_PAIR_STEP} is built in)")
    dps = args.dps if args.dps is not None else ONEFOLD_DPS_DEFAULT
    if dps < ONEFOLD_DPS_MIN:
        onefold_die(ONEFOLD_RC["refused"], f"icc-evaluate REFUSED: --onefold --dps {dps} below {ONEFOLD_DPS_MIN} (the bars are the compared count - {ONEFOLD_MARGIN})")
    masses = ONEFOLD_MASSES[cfg]
    m1, m2, m3, m4 = masses
    with mp.workdps(50):
        thr = onefold_threshold(masses)
        s0v = (sqrt(mpf(m3)) + sqrt(mpf(m4))) ** 2
        below = mpf(X.numerator) / X.denominator < thr
        thr_s = mp.nstr(thr, 10)
        s0_s = mp.nstr(s0v, 10)
    if not below:
        onefold_die(ONEFOLD_RC["refused"], f"icc-evaluate REFUSED: --onefold X = {X} is at or above the threshold x = {thr_s} of the "
                                           f"{CONFIG_LABEL[cfg]} cone on the slice (the lighter cone line and the scoop pair cut together, "
                                           f"(sqrt m_i + sqrt {m3} + sqrt {m4})^2): the real one-fold form is served below it only; the "
                                           f"physical region above needs the s-contour deformation, which this arm does not carry"
                                           + (" (the --minkowski X arm transports the connection to x + i0 there)" if cfg == "eqmass" else ""))
    strung = X in (_F(-1), _F(X_TARGET))
    if args.mutate and not strung:
        onefold_die(ONEFOLD_RC["refused"], f"icc-evaluate REFUSED: --onefold X --mutate exercises the stored-string comparison, which exists at "
                                           f"X = -1 and X = {X_TARGET} only (got X = {X})")
    if args.mutate and dps < ONEFOLD_MUTATE_DPS_MIN:
        onefold_die(ONEFOLD_RC["refused"], f"icc-evaluate REFUSED: --onefold --mutate at dps >= {ONEFOLD_MUTATE_DPS_MIN} (the bar must exceed the "
                                           f"{ONEFOLD_MUTATE_DIGIT - 1} digits the planted digit leaves; got --dps {dps})")
    dps2 = dps + ONEFOLD_PAIR_STEP
    print("=" * 78)
    print(f"ICC top master T(x) at eps^0 at x = {X}, {CONFIG_LABEL[cfg]}, by THE ONE-FOLD FORM: the scoop bubble as a")
    print("spectral propagator of squared mass s on [s0, inf) against the d = 2 triangle reduced to its three bubbles;")
    print(f"no boundary constant, no cusp solve, no transport.  dps {dps} and dps {dps2} (the two-precision self-check)")
    print("=" * 78)
    print(f"  squared masses (m1, m2 | m3, m4) = ({m1}, {m2} | {m3}, {m4}): the cone lines | the scoop pair; p56^2 = {ONEFOLD_P56}; "
          f"s0 = (sqrt {m3} + sqrt {m4})^2 = {s0_s}; the threshold in x: {thr_s} (refused at and above)")
    fails = []
    if cfg == "eqmass":
        form = "display form (the one-fold integral of logarithms; B(s; x) and Tri0 by the closed-form bubble)"
    else:
        form = "spectral form (the d = 2 triangle (m1, m2, s) reduced to its three bubbles)"
    vals, ims = {}, {}
    for d in (dps, dps2):
        t0 = time.time()
        v, est = onefold_display(X, d) if cfg == "eqmass" else onefold_spectral(X, masses, d)
        with mp.workdps(d + 10):
            vr, im = onefold_real(v)
            vals[d] = vr
            ims[d] = im
            print(f"  [one-fold {form}, dps {d}: {mp.nstr(vr, d + 5)}; engine estimate {mp.nstr(est, 3)} < 10^-{d + ONEFOLD_QUAD_GUARD} "
                  f"(certified); imaginary residue {mp.nstr(im, 3)}; {time.time() - t0:.1f} s]", flush=True)
        imbar = mpf(10) ** (-(d - ONEFOLD_MARGIN))
        if im > imbar:
            fails.append(f"imaginary residue {mp.nstr(im, 3)} at dps {d} above 10^-{d - ONEFOLD_MARGIN}")
    mp.dps = dps2 + 20
    pfl = minkowski_digits(vals[dps], vals[dps2])
    pair_digits = dps if pfl is None else min(pfl, dps)
    pbar = dps - ONEFOLD_MARGIN
    print(f"  the two-precision self-check dps {dps} vs dps {dps2}: " + ("identical" if pfl is None else f"{pfl:.1f} d")
          + f" -> the integral certifies {pair_digits:.1f} d (capped at dps; bar {pbar} d, RAISING)")
    if pfl is not None and pfl < pbar:
        fails.append(f"two-precision self-check {pfl:.1f} d < {pbar} d")
    if cfg == "eqmass":
        t0 = time.time()
        v2, est2 = onefold_spectral(X, masses, dps)
        with mp.workdps(dps + 10):
            v2r, im2 = onefold_real(v2)
        mp.dps = dps2 + 20
        dA = minkowski_digits(v2r, vals[dps2])
        print(f"  the second assembly (the spectral form: the d = 2 triangle (1, 1, s) reduced to its three bubbles, dps {dps}): "
              f"{mp.nstr(v2r, dps + 5)}; engine estimate {mp.nstr(est2, 3)}; imaginary residue {mp.nstr(im2, 3)}; vs the display form "
              + ("identical" if dA is None else f"{dA:.1f} d") + f" (bar {pbar} d, RAISING; {time.time() - t0:.1f} s)", flush=True)
        if dA is not None and dA < pbar:
            fails.append(f"the two assemblies {dA:.1f} d < {pbar} d")
        with mp.workdps(dps + 10):
            tri0 = onefold_bubble(ONEFOLD_P56, 1, 1)
            tri0c = 4 * log((1 + sqrt(5)) / 2) / sqrt(5)
            tri0r, _ = onefold_real(tri0)
        mp.dps = dps + 20
        dT = minkowski_digits(tri0r, tri0c)
        print(f"  Tri0 = I2(-1; 1, 1) by the closed-form bubble vs 4 ln(phi) / sqrt 5: " + ("identical" if dT is None else f"{dT:.1f} d")
              + f" (bar {pbar} d, RAISING)")
        if dT is not None and dT < pbar:
            fails.append(f"Tri0 vs its closed form {dT:.1f} d < {pbar} d")
    mp.dps = dps
    with mp.workdps(dps):
        v_p = +vals[dps]
    print(f"\n  T({X}) at eps^0, {CONFIG_LABEL[cfg]}: {mp.nstr(v_p, dps)}")
    print(f"  (dps {dps}; the two-precision self-check certifies {pair_digits:.1f} d)")
    top = DATA[cfg]["top_index"]
    stored = None
    if X == _F(-1):
        stored = (DATA[cfg]["boundary"][str(top)]["0"], f"the stored x = -1 string of the top master (icc-transport-data.json, {cfg} boundary block, eps^0)")
    elif X == _F(X_TARGET):
        stored = (ORACLE[(cfg, 0)], f"the stored AMFlow oracle string at x = {X_TARGET} (ORACLE[({cfg!r}, 0)], eps^0)")
    verdict_note = ""
    if stored is not None:
        s, label = stored
        note = ""
        if args.mutate:
            s = mutate_digit(s, ONEFOLD_MUTATE_DIGIT)
            note = (f" [NEGATIVE CONTROL --mutate: the string perturbed at its {ONEFOLD_MUTATE_DIGIT}th significant digit in memory "
                    f"-- the comparison MUST fail]")
        L = sig_digits(s)
        mp.dps = max(L, dps2) + 20
        ds = minkowski_digits(vals[dps], mpf(s))
        bar = min(pair_digits, L, dps) - ONEFOLD_MARGIN
        n_read = L if ds is None else int(min(ds, L))       # the digits the comparison reads, at most the string's length L
        n_of = int(min(n_read, pair_digits))                  # the printed count: capped at the digits the two-precision pair certifies (<= dps)
        capped = n_of == L                                    # 'reference-capped' only when the count is the string's full length
        cap_note = ("" if n_of == n_read else
                    f" (the comparison reads {n_read} of {L}; the count is capped at the {pair_digits:.1f} d the two-precision pair certifies)")
        print(f"  vs {label} ({L} d): " + ("identical at the working precision" if ds is None else f"{ds:.1f} d")
              + f" -- {n_of} of {L}" + (" (reference-capped: the value reproduces the string to its full length)" if capped else "")
              + cap_note + f"; bar {bar:.1f} d = min(the pair, {L}, dps) - {ONEFOLD_MARGIN}, RAISING{note}")
        if args.mutate:
            fired = ds is not None and ds < bar
            print(f"\n  [NEGATIVE CONTROL --mutate] the comparison reads {'identical' if ds is None else f'{ds:.1f} d'} vs bar {bar:.1f} -- "
                  f"{'CAUGHT (the expected FAIL by name; exit 1)' if fired else 'NOT CAUGHT (exit 6)'}")
            print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
            raise SystemExit(ONEFOLD_RC["fail"] if fired else ONEFOLD_RC["not_caught"])
        if ds is not None and ds < bar:
            fails.append(f"the value vs {label}: {ds:.1f} d < {bar:.1f} d")
        verdict_note = (f"; vs the stored {L}-d string {n_of} of {L}" + (" (reference-capped)" if capped else "")
                        + ("" if n_of == n_read else f" (the count capped at the pair; the comparison reads {n_read})"))
    else:
        print(f"  no stored string at x = {X} ({cfg}): the stored comparisons exist at x = -1 (the boundary string) and x = {X_TARGET} "
              f"(the AMFlow oracle) only; the value is certified by the two-precision self-check"
              + (" and the second assembly" if cfg == "eqmass" else "") + " and nothing else")
    if fails:
        print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
        raise RuntimeError("--onefold FAIL by name (below bar => nonzero exit): " + "; ".join(fails))
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print(f"ONEFOLD VERDICT PASS: x = {X}, {CONFIG_LABEL[cfg]}, dps {dps} / {dps2}; the pair {pair_digits:.1f} d{verdict_note}; "
          f"the value path of the transport tiers untouched")
    return v_p


# ---------------------------------------------------------------------------
# The two-script cross-check (2026-09-06).  The sibling front end
# icc-genmass-evaluate.py (the generic-mass DERIVATION at any rational masses)
# pins THIS file's sha256 in its PINS table and refuses a mismatch (exit 3).
# This file records no sha of the sibling (a pin in each direction would be
# circular: each file's bytes would depend on the other's); instead, before
# the --masses arm runs, it reads the sibling's recorded pin of this file and
# compares it with its own bytes: a mismatch means the pair is out of step
# (one script changed without the other) -> refuse by name, exit 3 (the
# sibling's own code for a pin mismatch); the sibling missing -> exit 4 (its
# code for a pinned file MISSING).  The MANIFEST.sha256 beside both pins the
# sibling's bytes themselves (sha256sum -c).
# ---------------------------------------------------------------------------
SIBLING_PIN = {
    "file": "icc-genmass-evaluate.py",
    "invocation": "python3 icc-genmass-evaluate.py --masses 1,M2,M3,M4 "
                  "--point X --dps D",
    "check": "its PINS['icc-evaluate.py'] == sha256 of this file's bytes",
    "exit_code_mismatch": 3,
    "exit_code_missing": 4,
}


def check_sibling_pair():
    """The pair check named in SIBLING_PIN: returns the sibling's recorded pin
    of this file after asserting it equals sha256(this file); prints and
    exits 3 / 4 by name otherwise."""
    import hashlib
    sib = os.path.join(HERE, SIBLING_PIN["file"])
    if not os.path.exists(sib):
        print(f"icc-evaluate MISSING: the sibling {SIBLING_PIN['file']} is "
              f"absent beside this file; the --masses arm is served only as "
              f"the pair; not serving", flush=True)
        raise SystemExit(SIBLING_PIN["exit_code_missing"])
    text = open(sib, encoding="utf-8").read()
    i0, i1 = text.find("\nPINS = {"), text.find("# --- END PINS ---")
    block = text[i0:i1] if (i0 >= 0 and i1 > i0) else ""
    hits = re.findall(r'^\s*"icc-evaluate\.py": "([0-9a-f]{64})",?\s*$',
                      block, re.M)
    if len(hits) != 1:
        print(f"icc-evaluate REFUSED: {SIBLING_PIN['file']} carries "
              f"{len(hits)} PINS entries for icc-evaluate.py (one expected); "
              f"the pair cannot be checked; not serving", flush=True)
        raise SystemExit(SIBLING_PIN["exit_code_mismatch"])
    recorded = hits[0]
    got = hashlib.sha256(
        open(os.path.abspath(__file__), "rb").read()).hexdigest()
    if got != recorded:
        pos = next(i + 1 for i in range(64) if got[i] != recorded[i])
        print(f"icc-evaluate REFUSED: the pair is out of step -- "
              f"{SIBLING_PIN['file']} records this file's sha256 as "
              f"{recorded} but this file's bytes hash to {got} (first "
              f"differing hex position {pos} of 64, 1-based): one of the "
              f"two scripts changed without the other (the sibling's pin "
              f"of this file must follow this file's bytes); not serving "
              f"--masses", flush=True)
        raise SystemExit(SIBLING_PIN["exit_code_mismatch"])
    print(f"  [pair] {SIBLING_PIN['file']} beside this file records this "
          f"file's sha256 {got[:16]}... == its own bytes: the pair is in "
          f"step (the generic-mass derivation at any rational masses: "
          f"{SIBLING_PIN['invocation']})")
    return recorded


def genmass_main(args):
    """--masses M2 M3 M4 driver (staged generic-mass fold)."""
    check_sibling_pair()
    from fractions import Fraction as _F
    t_all = time.time()
    if args.dps is None:
        args.dps = 40
    if args.point is None:
        args.point = X_TARGET
    m2v, m3v, m4v = (_F(s) for s in args.masses)
    if any(v <= 0 for v in (m2v, m3v, m4v)):
        raise SystemExit("REFUSED: --masses must be positive squared masses "
                         f"(got m2={m2v}, m3={m3v}, m4={m4v}); non-positive m^2 "
                         "is outside the derived kinematic domain (named refusal, "
                         "verifier issue c fix 7/07)")
    is_ref = (m2v, m3v, m4v) == gml.REFERENCE_MASSES
    print("=" * 78)
    print(f"ICC GENERIC-MASS mode (blog twin): squared masses (1, {m2v}, {m3v}, {m4v})"
          f", x={args.point}, dps={args.dps}")
    print("=" * 78)
    data_cfg = DATA["generic"]
    # ---- 1) sha-pinned witness load + ALWAYS-ON positive control ----------
    t0 = time.time()
    try:
        A = gml.load_a_symbolic()
    except gml.GenMassError as e:
        # the no-witness refusal (2026-09-06): named, the sibling pointed to;
        # exit code 1 = this script's own named-refusal form (SystemExit
        # with a message), the code the uncaught GenMassError exited with
        raise SystemExit(
            "REFUSED (generic-mass covariant-seed arm, fail closed): "
            + str(e) + "\n  T(x) at these masses is not computed by this "
            "script; the derivation at any rational masses is the sibling "
            "script icc-genmass-evaluate.py beside it (python3 "
            "icc-genmass-evaluate.py --masses 1,M2,M3,M4 --point X --dps D).")
    print(f"  [A' witness loader] {gml.A_SYMBOLIC_PIN['path']}")
    print(f"    sha256 {gml.A_SYMBOLIC_PIN['sha256'][:16]}... VERIFIED "
          f"({gml.A_SYMBOLIC_PIN['bytes']} bytes) [{time.time()-t0:.1f} s]")
    mut = (True if args.mutate_seed == "aprime" else None)
    t0 = time.time()
    nok, nbad, bad = gml.reference_identity_gate(data_cfg["coef"],
                                                 _mutate=mut)
    print(f"  [positive control] reference identity (2,3,5) vs stored coef: "
          f"{nok} ok / {nbad} bad [{time.time()-t0:.1f} s]")
    if nbad:
        raise gml.GenMassError(
            f"A' reference identity gate FAILED ({nbad} entries, e.g. "
            f"{bad[:3]}) -- loader/pipeline corrupt, refusing to specialize "
            f"(fail closed)")
    # ---- 2) optional never-read holdout-slice gate -------------------------
    if args.holdout_gate:
        t0 = time.time()
        hok, hbad, hb = gml.holdout_slice_gate(args.holdout_gate)
        print(f"  [holdout gate] {args.holdout_gate} (never-read reserved "
              f"slice): {hok} ok / {hbad} bad [{time.time()-t0:.1f} s]")
        if hbad:
            raise gml.GenMassError(
                f"holdout-slice gate FAILED at {args.holdout_gate}: "
                f"{hbad} positions, e.g. {hb[:3]} (fail closed)")
    # ---- 3) specialize the connection at the requested masses --------------
    t0 = time.time()
    coef = gml.build_transport_coef(m2v, m3v, m4v)
    print(f"  [connection] A(d,x; 1,{m2v},{m3v},{m4v}) specialized at "
          f"runtime: {len(coef)} eps-graded coef entries (exact, "
          f"pure-Fraction; d = 2-2eps frame) [{time.time()-t0:.1f} s]")
    # ---- 4) boundary at the requested masses (covariant classes) ----------
    t0 = time.time()
    overlay, Wgen, conv = _genmass_seeds(m2v, m3v, m4v, args.dps,
                                         mutate=args.mutate_seed
                                         if args.mutate_seed == "scoop"
                                         else None)
    print(f"  [boundary] {len(overlay)} covariant seeds DERIVED at runtime "
          f"(tadpole^2/triangle closed forms + LIVE scoop spectral "
          f"integrals; scoop conv {conv:.1f} d) [{time.time()-t0:.1f} s]")
    if is_ref:
        mp.dps = args.dps + 40
        defit = min(blib.agree_digits(v,
                    data_cfg["boundary"][str(i)][str(K)])
                    for (i, K), v in overlay.items()
                    if data_cfg["boundary"].get(str(i), {}).get(str(K)))
        print(f"    reference config: derived seeds vs stored strings "
              f"(held-out de-fit): min {defit:.1f} d")
        mp.dps = args.dps
    # ---- 5) fail-closed refusals (named) -----------------------------------
    print("  [REFUSED, fail closed] top/slave/dotted masters "
          "{6,7,8,12,13,14,15,16,17,18} grade<=0 boundary at non-reference "
          "masses:")
    print("    the cusp-solve stack (icc_layers_generic closed_forms_srepr, "
          "icc_slots_result slot ring, RESULT3 slave slots) is DERIVED at "
          "the reference config (2,3,5) only")
    print("    (GEN_G1_RESULT.md sec 7; generalizing it is the named "
          "remaining task).  T(x) at these masses is NOT printed here -- no "
          "silent substitution; the derivation at any rational masses is the"
          " sibling script icc-genmass-evaluate.py (--masses 1,M2,M3,M4 "
          "--point X --dps D).")
    if is_ref:
        print("    (requested masses ARE the reference config: use the "
              "default mode for the full T(x) path.)")
    # ---- 6) fresh-mass deliverable + dual-quadrature gate ------------------
    xq = mpf(args.point)
    if not (xq < mpf(-1) / 2):
        raise ValueError("x must be < -1/2 (Euclidean domain); the Minkowski "
                         "region x > 0 of the equal-mass slice is the --minkowski X "
                         "arm, x = -1/2 the --land arm and the band -1/2 < x < -1/4 "
                         "the --band X arm (none served at other masses)")
    print(f"\n  deliverables at x={args.point} (LIVE, two independent "
          f"runtime quadratures each):")
    qdps = min(args.dps, 40)
    results = {}
    for nm, i, cfg in (("S", 5, (1, m3v, m4v)), ("S14", 11, (m2v, m3v, m4v))):
        mp.dps = qdps + 15
        s = Scoop(*(mpf(c.numerator) / mpf(c.denominator)
                    if hasattr(c, 'numerator') and not isinstance(c, int)
                    else mpf(c) for c in cfg))
        t0 = time.time()
        v1 = s.S0(xq, maxdegree=10)
        v1b = s.S0(xq, maxdegree=11)
        seed_mut = (nm == "S" and args.mutate_seed == "scoop")
        if seed_mut:
            v1 += mpf(10) ** (-30) * fabs(v1)
        mp.dps = 40
        Pm = sqrt(-xq)
        ms = [sqrt(mpf(c.numerator) / mpf(c.denominator)
                   if hasattr(c, 'numerator') and not isinstance(c, int)
                   else mpf(c)) for c in cfg]
        v2 = -4 * quad(lambda t: t * besselj(0, Pm * t)
                       * besselk(0, ms[0] * t) * besselk(0, ms[1] * t)
                       * besselk(0, ms[2] * t), [0, 1, 5, 20, 60, 120])
        mp.dps = qdps + 15
        d = agree_digits(v1, mp.nstr(v2, 45))
        dself = agree_digits(v1, mp.nstr(v1b, qdps + 10))
        # bar: Bessel oracle computed at dps 40 -> measured agreement floor
        # ~41 d (4 configs); bar 35 leaves ~6 d margin AND catches a 1e-30
        # relative seed mutation (-> ~30 d < bar, rc!=0)
        bar = min(35, qdps + 5)
        print(f"    {nm}(x; {tuple(str(c) for c in cfg)}) = "
              f"{mp.nstr(v1, min(qdps, 40))}")
        print(f"      spectral vs independent Bessel-moment quad: {d:.1f} d "
              f"(bar {bar:.1f}); mdeg self-check {min(dself, qdps):.1f} d")
        if not (d >= bar):
            raise RuntimeError(
                f"genmass dual-quadrature gate FAIL for {nm} at x={args.point}"
                f", masses (1,{m2v},{m3v},{m4v}): {d:.1f} d < bar {bar:.1f} d "
                f"(rc!=0)")
        results[nm] = v1
    mp.dps = args.dps
    print(f"    tadpole^2/triangle eps^0 values (x-independent):")
    for i in (0, 1, 3, 4, 9, 2, 10):
        print(f"      master {i:2d} eps^0 = {mp.nstr(overlay[(i, 0)], 30)}")
    # ---- 7) two-precision rerun (D / D+40) ---------------------------------
    if args.check:
        print(f"\n  --check: two-precision rerun dps {args.dps} -> "
              f"{args.dps + 40} ...")
        t0 = time.time()
        overlay2, _, _ = _genmass_seeds(m2v, m3v, m4v, args.dps + 40)
        mp.dps = args.dps + 60
        dmin = min(agree_digits(overlay2[k], mp.nstr(overlay[k],
                   args.dps + 20)) for k in overlay if overlay[k] != 0)
        print(f"    seed agreement D vs D+40: min {dmin:.1f} d "
              f"(expect ~dps) [{time.time()-t0:.1f} s]")
        if dmin < args.dps - 8:
            raise RuntimeError(
                f"genmass two-precision rerun FAIL: {dmin:.1f} d < "
                f"dps-8 = {args.dps - 8} (rc!=0)")
        mp.dps = args.dps
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print("Generic-mass mode: connection specialized at runtime from the "
          "ADMITTED sha-pinned")
    print("A_symbolic.json (pure Fraction); covariant boundary classes "
          "derived at runtime;")
    print("reference-bound grades REFUSED fail-closed by name.  Stored "
          "strings fed NOTHING.")
    return results


if __name__ == "__main__":
    # line-buffer stdout so the first line lands immediately even when the
    # output is piped or redirected to a file (2026-09-03)
    try:
        _sys.stdout.reconfigure(line_buffering=True)
    except AttributeError:
        pass
    ap = argparse.ArgumentParser(
        description="ICC evaluator: runtime boundary derivation + eps-graded "
                    "DE-transport. Default run = quick equal-mass gate demo "
                    "at the held-out point x=-2 (dps 30, ~2 minutes on one "
                    "core); --full = both configurations at full precision.")
    ap.add_argument("--point", type=float, default=None, metavar="X",
                    help="evaluate at Euclidean x=X (must be < -1/2); off the "
                         "gate point no stored oracle exists; x = -1/2 is the --land "
                         "arm, the band -1/2 < x < -1/4 the --band X arm, the Minkowski "
                         "region x > 0 the --minkowski X arm")
    ap.add_argument("--dps", type=int, default=None, metavar="D",
                    help="working precision (default: per-config gate settings "
                         f"{SETTINGS['eqmass'][0]}/{SETTINGS['generic'][0]}; "
                         "Taylor order auto-scales; eq-mass boundary seeds are "
                         "derived at runtime at dps+25; generic eps^0 floors "
                         "at the ~(BDPS-13) recompute class in the default "
                         "recompute mode, or is capped by the 210 d stored "
                         "strings with --cached; generic eps^1 floors at the "
                         "~(g1dps-13) GEN_G1 class in every mode, "
                         "string-capped at ~110 d [reference-exhausted "
                         "19/19])")
    ap.add_argument("--config", choices=["eqmass", "generic", "both"],
                    default=None,
                    help="mass configuration (default: eqmass for the quick "
                         "default run; both under --full)")
    ap.add_argument("--full", action="store_true",
                    help="the full gate suite (the pre-2026-09-03 default): "
                         "BOTH mass configurations at the per-config gate "
                         "precision (eq-mass dps 135, generic dps 120 with "
                         "the generic boundary recompute and the GEN_G1 "
                         "eps^1 fold); tens of minutes on one core. Without "
                         "it the default is the quick equal-mass run at "
                         "dps 30 (~2 minutes on one core, same code path, "
                         "same held-out gate).")
    ap.add_argument("--double", action="store_true",
                    help="dps-doubling demo on the eq-mass gate point (single "
                         "2x-depth boundary derivation; long wall)")
    ap.add_argument("--boundary-recompute", nargs="?", const=-1, type=int,
                    metavar="BDPS", default=None,
                    help="GENERIC config, DEFAULT SINCE 2026-07-06 "
                         "(bare/absent: BDPS slaves to dps as max(110, "
                         "ceil(1.2*dps)); pass BDPS to override the depth): "
                         "recompute ALL 25 retained grade<=0 x=-1 literals -- "
                         "layer closed forms + cusp solve with the DERIVED "
                         "slot ring + lifted-order transport (production "
                         "25/25). Stored strings are a "
                         "compare-on-load cache ONLY, RAISES outside "
                         "resolution; (16,0)/(18,0) computed since the "
                         "2026-07-05 solver fix. The 19 grade-1 (eps^1) "
                         "seeds: 19/19 derived-or-injected in every generic "
                         "mode (GEN_G1 fold rev-2; 8 injected from the "
                         "sha-pinned NEPS=4 FINAL RESULT3_FINAL.json; "
                         "reference-exhausted 19/19). COST "
                         "(honesty about walls): +~360 s at BDPS 110 on an "
                         "otherwise idle core (390.3 s total measured for "
                         "the same code path at dps 60); "
                         "generic dps 120 -> BDPS 144 costs more "
                         "(~(bdps ratio)^2.2 measured); heavy load up to "
                         "~5x. Use --cached for the old fast path.")
    ap.add_argument("--cached", action="store_true",
                    help="GENERIC config: restore the OLD fast path for "
                         "grade<=0 ONLY -- no grade<=0 boundary recompute; "
                         "those stored 210 d strings supply the transport "
                         "directly (gate-cache semantics: the held-out "
                         "oracle gates still RAISE below bar). The recompute "
                         "default is the definition. Grade-1 (eps^1) is NOT "
                         "cached: the GEN_G1 fold runs in every generic mode "
                         "(rev-2; the demoted '1' strings are unreachable as "
                         "inputs). Mutually exclusive with "
                         "--boundary-recompute.")
    ap.add_argument("--masses", nargs=3, metavar=("M2", "M3", "M4"),
                    default=None,
                    help="STAGED FOLD: exact rational squared masses "
                         "(m1^2=1; reference 2 3 5); generic config only. "
                         "Connection specialized at runtime from the "
                         "ADMITTED sha-pinned A_symbolic.json; covariant "
                         "boundary classes derived; reference-bound "
                         "grades REFUSED fail-closed by name; T(x) at these "
                         "masses: icc-genmass-evaluate.py --masses 1,M2,M3,M4 "
                         "--point X --dps D (the sibling script beside this "
                         "one; the pair is checked first: exit 3 when its "
                         "recorded pin of this file does not match).")
    ap.add_argument("--holdout-gate", default=None, metavar="X_TAG",
                    help="with --masses: run the never-read reserved "
                         "holdout-slice gate (e.g. x_109o11_9)")
    ap.add_argument("--mutate-seed", default=None, choices=["scoop", "aprime"],
                    help="NEGATIVE CONTROL (with --masses): gates must "
                         "then fail (rc!=0)")
    ap.add_argument("--check", action="store_true",
                    help="GENERIC (--masses) ONLY: two-precision rerun of the "
                         "covariant seeds, dps -> dps+40. Accepted but a no-op "
                         "on --config eqmass (the equal-mass two-precision "
                         "pair is --double, or two runs at different --dps).")
    ap.add_argument("--g1-dps", type=int, default=None, metavar="D",
                    help="GEN_G1 eps^1 fold depth (default 60; measured "
                         "wall ~390-690 s at 60, 1568.8 s at 145; "
                         "accuracy class ~D-13, "
                         "string-capped at 110)")
    ap.add_argument("--g1-mutate", default=None,
                    choices=["tau1", "q8", "q8g1"],
                    help="NEGATIVE CONTROL: 1e-30 mutation of a GEN_G1 seed "
                         "input (tau1/q8: demoted derivation inputs; q8g1: "
                         "the INJECTED grade-1 Q8_1 slave slot); the "
                         "demoted-string compare gate MUST fail (rc!=0). "
                         "Mutation-power depth (measured): "
                         "1e-30 detectable at g1dps 60 (Q8-cone "
                         "seeds drop to ~30.8-31.9 d vs need 42 d); not "
                         "detectable below g1dps ~50 (need falls under the "
                         "~31 d mutated agreement).")
    ap.add_argument("--mutate-xm3", action="store_true",
                    help="NEGATIVE CONTROL (--config generic --point -3): the "
                         "vendored x=-3 eps^0 oracle string is perturbed in memory "
                         "at its 20th significant digit before the comparison "
                         "(the file and its pin untouched); the x=-3 gate MUST "
                         "then fail (rc!=0)")
    ap.add_argument("--offslice", nargs=2, metavar=("X", "Y"), default=None,
                    help="THE OFF-SLICE (X, Y) ARM (2026-09-06): X = p12^2, Y = p34^2 as exact "
                         "rationals (p56^2 = -1, m^2 = 1; X, Y < 0, X != Y): the nine off-slice "
                         "masters at eps^-2..eps^1 transported from the seed of record at (-3, -4) "
                         "along the vendored two-variable connection (vendor_rows1517_offslice/xy/) "
                         "and printed at dps + 5 digits; at the reference points (-3, -15/4), "
                         "(-5/2, -15/4), (-15/4, -5/2) gated against the vendored AMFlow values "
                         "(bar 30; the record's floors 48 / 47 / 47 named); --dps (default 60; "
                         "45 the record's other precision); refuses the slice, the census zeros "
                         "and points outside the Euclidean region by name (exit 2); every vendored "
                         "file sha256-pinned (exit 3 / 4); see the docstring")
    ap.add_argument("--seed-twin", action="store_true",
                    help="with --offslice: repeat the transport from the goal-60 seed "
                         "(xy/S34e5_g60.json) and print the twin agreement (the eps^1 floor ~ the "
                         "seed depth; bar 30); at (-3, -15/4) and (-5/2, -15/4) the goal-60 "
                         "transport is gated against the goal-60 AMFlow value too")
    ap.add_argument("--mutate", action="store_true",
                    help="NEGATIVE CONTROL of either arm (one option, read by each arm in its "
                         "own dispatch). With --offslice at a reference point: the eps^0 "
                         "string of the top master in the vendored goal-40 reference is perturbed "
                         "at its 20th significant digit in a copy the gate reads (the file and its "
                         "pin untouched); the gate MUST then fail by name (exit 1; exit 6 when not "
                         "caught). With --minkowski 12: the goal-40 record's (4,0) Re midpoint "
                         "perturbed in memory by a relative 1e-25 (the file and its pin "
                         "untouched); the gate MUST fail by name (exit 1; exit 6 if not caught). "
                         "With --land (or --band=-1/2): the vendored x = -1/2 record's (4,0) "
                         "midpoint perturbed in memory by a relative 1e-25; the gate MUST fail "
                         "by name (exit 1; exit 6 if not caught; dps >= 40). With --onefold=-1 / -2: "
                         "the stored comparison string perturbed at its 20th significant digit in "
                         "memory; the comparison MUST fail by name (exit 1; exit 6 if not caught; "
                         "dps >= 30)")
    ap.add_argument("--workdir", default=None, metavar="DIR",
                    help="with --offslice: where the engine's PREDICTION and the gate's COMPARE "
                         "receipts are written (default: a fresh temporary directory)")
    ap.add_argument("--minkowski", default=None, metavar="X",
                    help="THE MINKOWSKI (i0+) ARM (2026-09-06): the equal-mass masters at "
                         "x = X + i0, X > 0 an exact rational, by the complex detour "
                         "-1 -> -1 + iH -> X + iH -> X of the served seeds and graded "
                         "system (the boundary value from the upper half-plane); Re and "
                         "Im per component, the Schwarz and route controls; at X = 12 "
                         "the gate against the two vendored AMFlow physical-region "
                         "records (icc-reference-minkowski.json, sha256-pinned). The "
                         "threshold points {0, 1, 9, r+-} and X <= 0 are refused by "
                         "name (the Euclidean axis is --point X). Default dps 60 "
                         "(minutes; see WALLS in the docstring). Pass a value with a "
                         "leading minus as --minkowski=-2 --euclid-control. The "
                         "negative control of the gate is the shared --mutate option.")
    ap.add_argument("--detour", default=None, metavar="H",
                    help="with --minkowski: the detour height H > 0 (default 2; the "
                         "second route runs at H + 1, the lower detour at -H)")
    ap.add_argument("--pair", action="store_true",
                    help="with --minkowski: the transport pair -- the same upper detour "
                         "at dps + 30 (seeds re-derived at dps + 55), the floor over the "
                         "21 components printed and gated (bar dps - 8); the summary "
                         "line's second figure")
    ap.add_argument("--euclid-control", action="store_true",
                    help="with --minkowski X, X < -1/2: the Euclidean-limit control -- "
                         "the detour form to a Euclidean point vs the served real-axis "
                         "march and (at X = -2) the stored AMFlow oracle strings")
    ap.add_argument("--schwarz", action="store_true",
                    help="with --minkowski: print the per-component table of the "
                         "Schwarz control (the floor line prints on every run)")
    ap.add_argument("--mutate-sign", action="store_true",
                    help="NEGATIVE CONTROL (--minkowski 12): the LOWER detour (x - i0) "
                         "gated as if physical; the gate MUST fail by name on every "
                         "component with a resolved imaginary part (exit 1)")
    ap.add_argument("--land", action="store_true",
                    help="THE LANDING ARM AT x = -1/2 (2026-09-08): the equal-mass masters AT "
                         "the letter 2x + 1 = 0 by the circle landing of the slice connection "
                         "(the served seeds and graded system carried by the --minkowski arm's "
                         "engine to -1/2 - rho and once around |x + 1/2| = rho; the value = the "
                         "Cauchy circle mean; the finiteness and single-valuedness certificates; "
                         "the gate against the vendored AMFlow record at x = -1/2, "
                         "sha256-pinned). Default dps 60 (minutes); --pair adds the dps + 30 "
                         "twin (the record's pair is dps 110 / 140: hour-class). The negative "
                         "control is the shared --mutate option.")
    ap.add_argument("--rho", default=None, metavar="R",
                    help="with --land: the circle radius, an exact rational 0 < R <= 1/8 "
                         "(default 1/16, the record's)")
    ap.add_argument("--legs", type=int, default=None, metavar="N",
                    help="with --land: the sample points on the circle (default 1.7 dps + 20, "
                         "the record's count; N >= 16)")
    ap.add_argument("--second-radius", action="store_true",
                    help="with --land: repeat the circle at rho/2 and print the two-radius "
                         "agreement of the means (bar dps - 8)")
    ap.add_argument("--band", default=None, metavar="X",
                    help="THE BAND -1/2 <= X < -1/4 (2026-09-08): the top master at eps^0 by "
                         "the written integral (58) in its dispersion form (dps, default 45, "
                         "and dps + 15: the two-precision pair; the a-form cross-check) beside "
                         "the slice connection's complex detour around 2x + 1 = 0 (above and "
                         "below, at dps + 15), the two routes cross-gated; at X = -1/2 gated "
                         "against the vendored record instead; X < -1/2 with --euclid-control "
                         "is the control form (vs the served real-axis march and the stored "
                         "strings). Pass a value with a leading minus as --band=-9/20.")
    ap.add_argument("--onefold", default=None, metavar="X",
                    help="THE ONE-FOLD FAST PATH (2026-09-11): the eps^0 top master at a real X below the "
                         "cone's threshold on the slice (x < 9 at equal mass; (1 + sqrt 3 + sqrt 5)^2 at "
                         "--config generic, the squared masses (1,2,3,5)) by the one-fold integral of "
                         "logarithms -- the scoop bubble as a spectral propagator against the d = 2 triangle "
                         "reduced to its three bubbles; no boundary constant, no cusp solve, no transport. "
                         "Prints the value at dps (default 60) and dps + 30 (the two-precision self-check), "
                         "at equal mass a second assembly of the same integral, and at X = -1 / -2 the "
                         "agreement with the stored strings (RAISING below bar). X an exact rational or a "
                         "decimal; pass a leading minus as --onefold=-1. The negative control is the shared "
                         "--mutate option (at X = -1 / -2).")
    # rev-2: --no-g1 DROPPED (Test B). There is no
    # string-input mode for the grade-1 seeds; the GEN_G1 fold runs in
    # every generic mode and build_system hard-RAISES on any '1'-key read.
    # --offslice X Y (2026-09-06): the two values are exact rationals that may start with '-' ('-15/4'), which
    # argparse reads as an option name; they are passed through with a leading space (stripped before Fraction)
    if "--offslice" in _sys.argv:
        _i = _sys.argv.index("--offslice")
        for _k in (_i + 1, _i + 2):
            if _k < len(_sys.argv) and _sys.argv[_k].startswith("-") and _sys.argv[_k] != "--":
                _sys.argv[_k] = " " + _sys.argv[_k]
    # THE MINKOWSKI ARM (2026-09-06): a --minkowski value with a leading "-" that is
    # not a plain negative number (e.g. -5/2) reads as an option to argparse; pass it
    # through by a leading space (stripped in minkowski_main)
    if "--minkowski" in _sys.argv:
        _k = _sys.argv.index("--minkowski") + 1
        if _k < len(_sys.argv) and _sys.argv[_k].startswith("-") and _sys.argv[_k] != "--":
            _sys.argv[_k] = " " + _sys.argv[_k]
    # THE BAND (2026-09-08): a --band value with a leading '-' (every band point has one)
    # is passed through the same way (stripped in band_main)
    if "--band" in _sys.argv:
        _k = _sys.argv.index("--band") + 1
        if _k < len(_sys.argv) and _sys.argv[_k].startswith("-") and _sys.argv[_k] != "--":
            _sys.argv[_k] = " " + _sys.argv[_k]
    # THE ONE-FOLD FAST PATH (2026-09-11): a --onefold value with a leading '-' is passed through the same way
    # (stripped in onefold_main)
    if "--onefold" in _sys.argv:
        _k = _sys.argv.index("--onefold") + 1
        if _k < len(_sys.argv) and _sys.argv[_k].startswith("-") and _sys.argv[_k] != "--":
            _sys.argv[_k] = " " + _sys.argv[_k]
    args = ap.parse_args()
    # THE ONE-FOLD FAST PATH (2026-09-11): --onefold is an arm of its own; with --offslice (dispatched first) refuse the pair
    if args.onefold is not None and args.offslice is not None:
        ap.error("--onefold X and --offslice X Y are separate arms; pass one")
    # THE OFF-SLICE (X, Y) ARM (2026-09-06): dispatched before the served default resolution; the arm runs
    # instead of the served tiers and exits with its own code (0 PASS, 1 FAIL, 2 REFUSED, 3 / 4 pins, 5 engine, 6)
    if args.offslice is not None:
        raise SystemExit(offslice_main(args))
    # THE MINKOWSKI ARM (2026-09-06): --mutate is the negative control of BOTH arms (one declaration above); it is
    # refused here only when neither arm is named (the --minkowski dispatch below reads it for its own control)
    if args.seed_twin or args.workdir or (args.mutate and args.minkowski is None and not args.land and args.band is None
                                            and args.onefold is None):
        ap.error("--seed-twin and --workdir belong to the --offslice arm (--offslice X Y); --mutate belongs to the "
                 "--offslice arm (at a reference point), to the --minkowski arm (--minkowski 12), to the --land arm, "
                 "to --band=-1/2 or to --onefold=-1 / -2")
    # THE ONE-FOLD FAST PATH (2026-09-11): runs instead of the served tiers (its own refusals name the other arms' options)
    if args.onefold is not None:
        print(f"[mode] the one-fold fast path at x = {args.onefold.strip()}, {args.config if args.config is not None else 'eqmass'}, dps "
              f"{args.dps if args.dps is not None else ONEFOLD_DPS_DEFAULT} / {(args.dps if args.dps is not None else ONEFOLD_DPS_DEFAULT) + ONEFOLD_PAIR_STEP}: "
              f"a quadrature of logarithms (no boundary derivation, no transport)")
        onefold_main(args)
        raise SystemExit(0)
    # THE MINKOWSKI ARM (2026-09-06): runs instead of the served tiers
    if args.minkowski is not None:
        try:
            _sys.stdout.reconfigure(line_buffering=True)
        except AttributeError:
            pass
        print(f"[mode] Minkowski (i0+) detour arm at x = {args.minkowski.strip()}"
              f"{' (the Euclidean-limit control)' if args.euclid_control else ' + i0'}, dps "
              f"{args.dps if args.dps is not None else 60}: minutes on one core (the seeds, then three "
              f"detour routes; --pair adds the dps + 30 twin; see WALLS in the docstring)")
        minkowski_main(args)
        raise SystemExit(0)
    # THE LANDING ARM / THE BAND (2026-09-08): run instead of the served tiers, after the --minkowski dispatch
    if args.land and args.band is not None:
        ap.error("--land (x = -1/2 only) and --band X are separate arms; pass one")
    if args.land or args.band is not None:
        try:
            _sys.stdout.reconfigure(line_buffering=True)
        except AttributeError:
            pass
        if args.land:
            print(f"[mode] the landing arm at x = -1/2, dps {args.dps if args.dps is not None else 60}: minutes on one core "
                  f"(the seeds, the real leg, the circle; --pair adds the dps + 30 twin; see WALLS in the docstring)")
            land_main(args)
        else:
            print(f"[mode] the band arm at x = {args.band.strip()}, dps {args.dps if args.dps is not None else BAND_DPS_DEFAULT}: "
                  f"minutes on one core (the integral at two precisions, the a-form, the two detours; see WALLS)")
            band_main(args)
        raise SystemExit(0)
    if args.rho is not None or args.legs is not None or args.second_radius:
        ap.error("--rho, --legs and --second-radius belong to the --land arm")
    if args.detour is not None or args.pair or args.euclid_control or args.schwarz or args.mutate_sign:
        ap.error("--detour, --pair, --euclid-control, --schwarz and --mutate-sign belong to the "
                 "--minkowski arm (--minkowski X); --pair also to --land, --euclid-control also to --band X")
    # Default resolution (2026-09-03): bare invocation = quick equal-mass
    # run at dps 30 (the same code path as --config eqmass --dps 30, ~2
    # minutes on one core); --full = the former default (both configs at
    # the full per-config gate precision, tens of minutes).
    quick_default = False
    if args.config is None:
        if args.full:
            args.config = "both"
        else:
            args.config = "eqmass"
            if args.dps is None and args.masses is None:
                args.dps = 30
                quick_default = True
    configs = ["eqmass", "generic"] if args.config == "both" else [args.config]
    if args.g1_mutate and "generic" not in configs and args.masses is None:
        ap.error("--g1-mutate exercises the generic eps^1 fold: pass "
                 "--config generic (or --full)")
    # first-line mode banner, before any computation (line-buffered above)
    if args.masses is not None:
        print(f"[mode] generic-mass covariant-seed run at squared masses "
              f"(1, {args.masses[0]}, {args.masses[1]}, {args.masses[2]}): "
              f"a few minutes on one core")
    elif args.double:
        print("[mode] dps-doubling demo, equal mass at twice the default "
              "precision: a long run (tens of minutes) on one core")
    elif quick_default:
        print("[mode] quick equal-mass run (--config eqmass --dps 30): about "
              "two minutes on one core; --full runs both mass configurations "
              "at full precision (tens of minutes)")
    elif "generic" in configs:
        _lbl = ("full run, both mass configurations"
                if args.config == "both" else "generic-mass run")
        _p = ("full default precision" if args.dps is None
              else f"dps {args.dps}")
        print(f"[mode] {_lbl} at {_p}: tens of minutes on one core")
    else:
        _p = ("the full default precision" if args.dps is None
              else f"dps {args.dps}")
        print(f"[mode] equal-mass run at {_p}: minutes on one core")
    if args.masses is not None:
        genmass_main(args)
        raise SystemExit(0)
    if args.holdout_gate or args.mutate_seed:
        ap.error("--holdout-gate/--mutate-seed require --masses")
    # the x = -3 oracle (2026-09-06): the pin FIRST, before any computation
    # the point test exact (2026-09-06): --point is a float; its repr as an exact
    # rational against the oracle's x.  A --point that is not a finite rational
    # (inf, nan) is never the x = -3 point, as before.
    try:
        from fractions import Fraction as _F
        xm3_point = (args.point is not None
                     and _F(str(args.point)) == _F(str(ORACLE_XM3["x"]))
                     and ORACLE_XM3["config"] in configs and not args.double)
    except ValueError:
        xm3_point = False
    if args.mutate_xm3 and not xm3_point:
        ap.error(f"--mutate-xm3 exercises the x = {ORACLE_XM3['x']} oracle gate: pass "
                 f"--config {ORACLE_XM3['config']} --point {ORACLE_XM3['x']}")
    if xm3_point:
        _XM3["data"], _XM3["strings"] = load_oracle_xm3()
        _XM3["mutate"] = bool(args.mutate_xm3)
    if args.cached and args.boundary_recompute is not None:
        ap.error("--cached and --boundary-recompute are mutually exclusive "
                 "(--cached = old fast path; recompute is the default)")

    # DEFAULT SINCE 2026-07-06: the generic boundary recompute runs unless
    # --cached (or --double, which never evaluates the generic config).
    # Acceptance evidence: 390.3 s measured at dps 60 ->
    # BDPS 110, 25/25, cache-min 99.9 d.  t_all starts HERE so the printed
    # total wall includes the default recompute (honesty about walls).
    t_all = time.time()
    if "generic" in configs and not args.double:
        if not args.cached:
            bd = (args.boundary_recompute
                  if args.boundary_recompute is not None else -1)
            if bd < 0:    # default / bare flag: slave BDPS to generic dps
                gdps = (args.dps if args.dps is not None
                        else SETTINGS["generic"][0])
                bd = max(110, -(-12 * gdps // 10))   # max(110, ceil(1.2*dps))
                print(f"[boundary recompute (DEFAULT)] BDPS slaved to dps -> "
                      f"max(110, ceil(1.2*{gdps})) = {bd}")
            _BREC["bdps"] = bd
            print(f"[boundary recompute at BDPS {_BREC['bdps']}] recomputing "
                  f"ALL 25 generic retained literals (recompute spec + slot5 "
                  f"fix) ...")
            (_BREC["overlay"], _BREC["cache"],
             _BREC["wall"]) = generic_boundary_recompute(_BREC["bdps"])
        else:
            print("[--cached] OLD fast path, grade<=0 ONLY: the stored "
                  "210 d grade<=0 generic strings supply the transport (no "
                  "grade<=0 recompute; oracle gates still RAISE below bar). "
                  "The recompute DEFAULT is the definition. Grade-1 is NOT "
                  "cached: the GEN_G1 fold below runs in every generic mode "
                  "(rev-2 -- no string-input mode exists for K=1).")
        # GEN_G1 eps^1 fold (rev-2): runs in EVERY generic mode -- --no-g1
        # DROPPED (Test B; the demoted '1' strings
        # are unreachable as inputs, hard guard at build_system)
        gd = args.g1_dps if args.g1_dps is not None else 60
        print(f"[GEN_G1 eps^1 fold rev-2] deriving 11 + injecting 8 generic "
              f"grade-1 seeds at runtime (g1dps {gd}; vendored boundary-derivation "
              f"row16_g1_v2 stack + sha-pinned NEPS=4 FINAL "
              f"RESULT3_FINAL.json, subprocess; measured wall ~390-690 s "
              f"at 60) ...")
        _G1["dps"] = gd
        (_G1["overlay"], _G1["gate"],
         _G1["wall"]) = generic_g1_recompute(gd, mutate=args.g1_mutate)
        print(f"[GEN_G1 eps^1 fold] 19/19 grade-1 seeds derived-or-injected "
              f"[{_G1['wall']:.0f} s]; demoted-string compare gates "
              f"min {min(_G1['gate'].values()):.1f} d over all 19 (strings "
              f"are held-out gates ONLY); 8 slave-master seeds "
              f"{G1_INJECTED_MASTERS} INJECTED from the NEPS=4 FINAL "
              f"grade-1 slave slots (RESULT3_FINAL.json sha-pinned; "
              f"reference-exhausted 19/19)")

    if args.double:
        run_double()
    elif args.point is not None and args.point != X_TARGET:
        run_point(configs, args.point, dps=args.dps)
    else:
        run_gate(configs, dps=args.dps)
    print(f"\nTotal wall time: {time.time() - t_all:.1f} s")
    print("Every 'this work' number above was transported at runtime from")
    print("boundary constants DERIVED at runtime (eq mass: infinity-cusp")
    print("conditions, NO AMFlow input; generic: 21/46 runtime-derived")
    if _BREC["overlay"] is not None:
        print("+ ALL 25 grade<=0 retained literals RECOMPUTED (default since"
              " 2026-07-06)")
        print("+ ALL 19 grade-1 eps^1 seeds derived-or-injected [GEN_G1 fold"
              " rev-2: 11 derived,")
        print("8 injected from the sha-pinned NEPS=4 FINAL RESULT3_FINAL.json"
              " -- provenance")
        print("the vendored sha-pinned RESULT3_FINAL.json]: stored strings"
              " supplied NOTHING, at any grade;")
        print("the eps^1 table is reference-exhausted 19/19).")
    elif "generic" in configs and not args.double:
        print("(--cached fast path, grade<=0 only: 25 grade<=0 literals supplied"
              " the transport;")
        print("the recompute DEFAULT is the definition. Grade-1 eps^1: 19/19"
              " derived-or-")
        print("injected [GEN_G1 fold rev-2] -- the grade-1 strings fed"
              " NOTHING).")
    else:
        print("(generic config not evaluated this run).")
    print("Stored numbers are held-out oracles / de-fit references.")
