diff --git a/docs/manuscripts/geometric-balance/branch-endpoint-dressing-beta-law-20260914.md b/docs/manuscripts/geometric-balance/branch-endpoint-dressing-beta-law-20260914.md new file mode 100644 index 000000000..26ab488c9 --- /dev/null +++ b/docs/manuscripts/geometric-balance/branch-endpoint-dressing-beta-law-20260914.md @@ -0,0 +1,157 @@ +# Branch endpoint dressing, singularity order, and the split-fraction Beta law + +Date: 2026-09-14 + +Status: exact convolution/Tauberian algebra plus a mechanism diagnostic for #758/#762/#800. It generalizes the equal-rate exponential/Uniform-split picture in `span-double-pole-branch-convolution-20260914.md`. + +## 1. One-sided branch ansatz + +Suppose a one-sided excess branch of integer length h has asymptotic weight + +```text +b_h + ~ C/Gamma(alpha) * h^(alpha-1) rho^h, (1.1) +``` + +with `alpha>0` and `0 Beta(alpha,alpha), (3.1) +``` + +with density + +```text +u^(alpha-1)(1-u)^(alpha-1)/B(alpha,alpha). +``` + +Therefore the morphology and the singularity order cross-check one another: + +```text +span prefactor h^(2alpha-1) +<=> generating singularity order 2alpha +<=> branch split Beta(alpha,alpha). (3.2) +``` + +## 4. Why alpha=1 is plausible for a free branch endpoint + +A fixed-root to **fixed-point** two-dimensional Ornstein--Zernike connection typically has a longitudinal `h^-1/2` prefactor, suggestive of `alpha=1/2` if that fixed endpoint were the branch observable. + +A complete-component branch endpoint is not pinned to one transverse site. In the simultaneous regime where the transverse Gaussian spread is `O(sqrt(h))` and is much smaller than the circumference, summing over the `O(sqrt(h))` typical endpoint locations cancels the point-to-point `h^-1/2` local-CLT factor. This heuristically restores + +```text +b_h ~ const * rho^h, +``` + +that is `alpha=1`. + +This is a mechanism argument, not a proof for square SITE. Near criticality, endpoint arm insertions can also change amplitudes in the correlation length; those must be separated from the power of h. + +## 5. A three-way falsification test + +The same `alpha` can be estimated three ways without fitting an arbitrary morphology model: + +### Spectrum + +Fit the late span response to + +```text +h^(2alpha-1) rho^h +``` + +or the corresponding singularity order. + +### Hazard + +From (2.2), + +```text +gamma_eff(h) + = gamma - (2alpha-1)/h + O(h^-2). (5.1) +``` + +### Morphology + +At fixed large excess-span bins, fit/test + +```text +U = A_-/(A_-+A_+) ~ Beta(alpha,alpha). (5.2) +``` + +Agreement of the same alpha across (5.1)--(5.2) would be a substantially stronger mechanism test than a single span exponent. + +In particular: + +- `alpha=1`: Uniform U and double-pole/Erlang span; +- `alpha=1/2`: arcsine U, endpoint concentration, and simple-pole total span. + +This makes the planned #762 U statistic directly informative about endpoint sewing/prefactor structure relevant to #740/#758. + +## 6. Claim boundary + +- Exact algebra under ansatz (1.1): Sections 2--3 and hazard expansion (5.1). +- Mechanism hypothesis: free transverse endpoint summation yields `alpha=1` for the long SITE branch. +- Not claimed: the one-sided branch factorization, the value of alpha for actual SITE complete components, or equality with a fixed-end two-point OZ amplitude. diff --git a/docs/manuscripts/geometric-balance/span-double-pole-branch-convolution-20260914.md b/docs/manuscripts/geometric-balance/span-double-pole-branch-convolution-20260914.md new file mode 100644 index 000000000..21fd11961 --- /dev/null +++ b/docs/manuscripts/geometric-balance/span-double-pole-branch-convolution-20260914.md @@ -0,0 +1,212 @@ +# A two-ended branch explanation for the span doublet + +Date: 2026-09-14 + +Status: a mechanism-level conjecture motivated by the visible-pole diagnostic in `span-visible-pole-splitting-20260914.md` and by the loop--branch decomposition in #758. It is more specific than the generic metastable-doublet interpretation and yields direct tests for #762. + +## 1. The algebraic signature + +The stored complete-component span spectra show two slow positive visible poles + +```text +rho_+ > rho_- +``` + +with nearly opposite scalar residues. This is exactly the signature produced by a convolution of two one-sided geometric/exponential waiting laws. + +If two nonnegative branch lengths `A_-`, `A_+` have generating functions + +```text +B_-(z) ~= C_-/(1-rho_- z), +B_+(z) ~= C_+/(1-rho_+ z), +``` + +then their sum has + +```text +B_-(z) B_+(z) + ~= const / [(1-rho_- z)(1-rho_+ z)]. (1.1) +``` + +The coefficient is a difference of two exponentials with opposite residues: + +```text +[z^h] B_- B_+ + proportional to + (rho_+^(h+1)-rho_-^(h+1))/(rho_+-rho_-). (1.2) +``` + +As the two one-sided masses coalesce, `rho_+-rho_- -> 0`, (1.2) tends to + +```text +const * (h+1) rho^h. (1.3) +``` + +Thus a near-double pole naturally produces both observations in #800: + +- coalescing visible roots; +- residues with ratio near `-1`. + +No metastable tunnelling interpretation is required for this algebra. + +## 2. Geometric interpretation for complete winding components + +In the saturated large-span branch of the #758 candidate, write schematically + +```text +L = L_core + A_- + A_+, +``` + +where `L_core` is the vertically saturated winding core and `A_-`, `A_+` are lower/upper longitudinal decorations or branches. + +The rate candidate above saturation pays a linear cost only for the **total** excess branch length. This leaves a one-dimensional split degeneracy between the two ends. If the two far branch excursions are asymptotically separated by the saturated core and share the same one-sided cylinder mass, then the natural first approximation is precisely the convolution in Section 1. + +This gives a direct bridge: + +```text +#758 linear branch rate + + +two-ended branch split + -> +double-pole / Erlang-type subexponential factor. (2.1) +``` + +The LDP exponent can therefore be correct even when the fixed-w scalar response never looks like a single exponential on height `O(w)`. + +## 3. New subexponential prediction + +In the exactly coalesced idealization, + +```text +d_h ~= C h e^{-gamma h}. (3.1) +``` + +Consequently the tail also has a linear polynomial factor, + +```text +P(L>=h) ~= C' (h+c0) e^{-gamma h}, (3.2) +``` + +and the finite-height hazard satisfies + +```text +gamma_eff(h) + = -log[T(h+1)/T(h)] + = gamma - 1/h + O(h^-2) (3.3) +``` + +in the pre-splitting regime `h |gamma_+-gamma_-| << 1`. + +For `h=A w`, the `log h` prefactor contributes only `O(log w/w)` to the finite-size rate and therefore does not alter the #758 linear LDP slope. It does, however, matter for prefactor diagnostics and for any attempt to identify the ultimate fixed-w pole from moderate heights. + +The current NN `p=1/4` hazards are qualitatively consistent with this correction; this note does not claim that the coefficient `1` in (3.3) has already been numerically certified for the full SITE model. + +## 4. A direct #762 prediction: uniform branch split + +If in the asymptotic branch regime the two one-sided excesses are independent exponentials with the same rate, + +```text +A_- ~ Exp(gamma), +A_+ ~ Exp(gamma), +``` + +then conditional on their total + +```text +R=A_-+A_+, +``` + +the fraction + +```text +U=A_-/(A_-+A_+) +``` + +is exactly + +```text +boxed: U | R ~ Uniform(0,1). (4.1) +``` + +Equivalently `(A_-/R,A_+/R)` is `Dirichlet(1,1)`. + +This turns one of #762's morphology options into a sharply motivated test rather than a generic candidate. In the saturated branch regime, the two-ended convolution mechanism predicts simultaneously: + +1. `L_core/w` saturates near the #758 optimizer; +2. the excess `L-L_core` carries the linear tail cost; +3. `U` approaches Uniform(0,1) away from zero-excess cases; +4. the scalar span spectrum develops a double-pole/Erlang prefactor. + +Failure of (4.1), especially strong endpoint condensation, would favor an asymmetric single-long-branch mechanism and would require a different explanation of the opposite residues. + +## 5. Split poles as a finite-width deformation + +The empirical poles are close but not exactly equal. A natural finite-width deformation is + +```text +gamma_- = gamma_bar - Delta/2, +gamma_+ = gamma_bar + Delta/2. (5.1) +``` + +Then the branch-sum coefficient is the hypoexponential form (1.2). The near-equal masses may come from weak endpoint/core asymmetry or from interaction between the two branch excursions through the finite core. + +This interpretation is distinct from, but not mutually exclusive with, a metastable two-sector transfer block. The decisive check is the actual slow eigenvector geometry: + +- if the two modes localize on upper/lower branch or two serial excursion stages, the convolution mechanism is supported; +- if they instead distinguish a global topology bit unrelated to branch orientation, the metastable-sector mechanism is more plausible. + +## 6. Relation to the loop--branch rate + +Above the saturated core size `r_*(p)`, the #758 candidate is + +```text +I_p(A)=kappa A + c_*, +``` + +so all partitions of the excess span between the two ends have the same leading exponential cost. The continuum of branch splits is exactly the kind of zero mode that produces a polynomial prefactor while leaving the large-deviation rate unchanged. + +A sharpened conjecture is therefore: + +```text +P_Palm(L≈A w) + = w^beta C_p(A) exp[-w I_p(A)] [1+o(1)], (6.1) +``` + +with an additional `beta=1` contribution from the two-ended split degeneracy in the strictly saturated linear branch, relative to a convention where the core location and one branch split are otherwise fixed. The total exponent beta also contains rooting/unrooting and transverse fluctuation factors, so `beta=1` is **not** claimed as the final complete-component prefactor. + +The robust part is the predicted linear-in-excess split measure and Uniform(0,1) conditional fraction, not a final absolute power of w. + +## 7. What to test next + +### Existing operator, no new width production + +Extract the two slow visible eigenvectors and inspect whether their state mass distinguishes upper/lower branch stages or a global topology bit. + +### #762 morphology + +At `L>=A w` for `A=1,2`, record the already planned + +```text +L_core, +A_-, A_+, +U=A_-/(A_-+A_+). +``` + +The strongest mechanism test is not the mean of U but its conditional law at fixed excess-span bins. + +### Spectrum + +Fit the late sequence directly to both models: + +```text +M1: c1 rho1^h + c2 rho2^h, +M2: (a+b h) rho^h, +``` + +on nested windows. If `M2` becomes competitive as w grows while the fitted pole split shrinks, that is the expected coalescing-convolution signature. + +## 8. Claim boundary + +- Exact algebra: convolution of two simple poles gives opposite residues and a double-pole/Erlang limit; equal-rate exponentials give the Uniform branch fraction. +- Data-supported hypothesis: the SITE span doublet may be realizing this two-ended branch convolution. +- Not claimed: asymptotic independence of `A_-` and `A_+`, identification of the slow eigenvectors, or a final complete-component w-prefactor. diff --git a/docs/manuscripts/geometric-balance/span-visible-pole-splitting-20260914.md b/docs/manuscripts/geometric-balance/span-visible-pole-splitting-20260914.md new file mode 100644 index 000000000..b4cb640ce --- /dev/null +++ b/docs/manuscripts/geometric-balance/span-visible-pole-splitting-20260914.md @@ -0,0 +1,199 @@ +# Coalescing visible poles in the complete-component span spectrum + +Date: 2026-09-14 + +Status: bounded diagnostic from the already committed `span-spectrum-20260913.json`, plus a correction to one proposed proof route for #758/#760. No new transfer build or width production is used. + +## 1. Why this check matters + +For fixed circumference `w`, the tagged complete-component span sequence has a finite-state representation + +```text +d_h = alpha R^(h-1) b. +``` + +Hence its ultimate `h->infinity` decay is controlled by the slowest **visible** pole of the source/readout pair. A tempting bridge between #758 and #760 is to assume that the relaxation to that pole occurs on a scale `o(w)`, so that the simultaneous macroscopic regime `h=A w` already sees the fixed-w Perron tail. + +The existing span data give a strong negative diagnostic for that assumption. + +## 2. Frozen two-pole extraction + +Input: + +```text +results/geometric-consistency/span-spectrum-20260913.json +``` + +No solver is rerun. + +For each stored `d_h` sequence, fit on the late window beginning at `h=13` the second-order recurrence + +```text +d_(h+2) = S d_(h+1) - P d_h. (2.1) +``` + +Each row is divided by `d_(h+1)` before the two-parameter least-squares solve, avoiding the many-decade dynamic range. The two recurrence roots are reported as effective visible poles + +```text +rho_1 > rho_2 > 0. +``` + +A separate two-exponential fit + +```text +d_h ~= c_1 rho_1^(h-1) + c_2 rho_2^(h-1) (2.2) +``` + +checks the residues. This is a projected/Prony diagnostic, not a certified full-matrix eigensolve. + +For NN `p=1/4`, widths 2--7 give stable real roots and late-window relative residuals between about `1e-12` and `1e-7` (the largest widths inherit the stored float residuals). + +## 3. NN p=1/4 result + +Representative values are: + +| w | rho1 | rho2 | Delta gamma=log(rho1/rho2) | xi_rel=1/Delta gamma | xi_rel/w | c2/c1 | +|---:|---:|---:|---:|---:|---:|---:| +| 2 | .290359457 | .187500000 | .437340815 | 2.29 | 1.14 | -.9984 | +| 3 | .329288918 | .303004745 | .083187071 | 12.02 | 4.01 | -1.0049 | +| 4 | .344536629 | .334361548 | .029977523 | 33.36 | 8.34 | -1.0204 | +| 5 | .350913754 | .346766728 | .011888178 | 84.12 | 16.82 | -1.0153 | +| 6 | .353568560 | .351836957 | .004909537 | 203.69 | 33.95 | -1.0091 | +| 7 | .354597156 | .354034203 | .001588845 | 629.39 | 89.91 | -1.0038 | + +Two features are much more important than the individual digits: + +1. the two slow visible poles rapidly coalesce; +2. their fitted residues are nearly equal and opposite. + +Thus the scalar span response is not approaching its one-pole regime on an `O(w)` height scale in these controls. + +The same phenomenon becomes even stronger deeper in the subcritical phase / on the matching graph. Examples from the same stored file: + +```text +NN p=1/8, w=6: xi_rel ~= 5288, c2/c1 ~= -1.00026; +matching p=1/16, w=5: xi_rel ~= 321, c2/c1 ~= -1.00365; +matching p=1/16, w=6: xi_rel ~= 1209, c2/c1 ~= -1.00138. +``` + +So this is not a one-point anomaly of NN `p=1/4`. + +## 4. Direct macroscopic-hazard check + +Let + +```text +T_w(h)=sum_{j>=h} d_j +``` + +with the stored tail bin appended. Define the finite-height hazard + +```text +gamma_eff,w(h) = -log[T_w(h+1)/T_w(h)]. (4.1) +``` + +For NN `p=1/4`: + +```text +w=4: gamma_eff(w)=0.7790, gamma_eff(2w)=0.9436, + ultimate two-pole gamma1=1.0656; +w=5: 0.7867, 0.9388, gamma1=1.0472; +w=6: 0.8042, 0.9440, gamma1=1.0397; +w=7: 0.8242, 0.9519, gamma1=1.0368. +``` + +The `h=w,2w` tails are visibly not in the fixed-w ultimate Perron regime. + +This does **not** falsify the #758 macroscopic LDP. It falsifies the shortcut that would derive that LDP by first taking `h->infinity` at fixed w and then assuming a relaxation length `o(w)`. + +## 5. Noncommuting limits and a replacement asymptotic picture + +Write the two slow pole masses as + +```text +gamma_1 = gamma_bar - Delta/2, +gamma_2 = gamma_bar + Delta/2, +``` + +and suppose the corresponding residues are approximately `A` and `-A`, plus a smaller common component `B/2`. Then + +```text +d_h + ~= exp(-gamma_bar h) + [ B cosh(Delta h/2) + 2 A sinh(Delta h/2) ]. (5.1) +``` + +If `Delta w -> 0`, then for `h=A0 w` + +```text +d_h + ~= exp(-gamma_bar h) + [ B + A Delta h + o(Delta h) ]. (5.2) +``` + +Thus a coalescing pair can have an exponentially long fixed-w relaxation time while the simultaneous `h=O(w)` exponential rate is still governed by the common centre mass `gamma_bar`. The near-cancellation changes subexponential/polynomial factors much more strongly than the large-deviation exponent. + +This is a better interface for #758: + +> prove that all macroscopically relevant visible slow modes have masses converging to the same planar cost `kappa`, while all truly fast modes remain separated; do **not** require the slow doublet to have mixed to one Perron vector by height `A w`. + +## 6. Relation to #760 + +The periodic-locality argument on #760 concerns the location of the ultimate cylinder mass `gamma_w` relative to the plane mass `kappa`. The coalescing-pole diagnostic does not contradict an exponentially small `gamma_w-kappa` correction. + +What it changes is measurement/proof strategy: + +- finite-height hazards at `h=O(w)` should not be used as direct estimators of the ultimate fixed-w `gamma_w`; +- conversely, the fixed-w leading Perron pole should not be substituted into an `h=A w` morphology argument without controlling the neighboring visible pole and its residue. + +The two limits + +```text +h->infinity at fixed w, +and +w->infinity with h=A w +``` + +need not commute at the level of the visible decomposition even if both exponential masses converge to `kappa`. + +## 7. A new metastable-doublet conjecture + +For fixed subcritical p, the data suggest a two-dimensional slow visible subspace whose splitting is exponentially small in w. A deliberately weak conjecture is + +```text +Delta gamma_w = exp[-Theta(w)], (7.1) +``` + +with opposite-sign source/readout residues and a common centre mass tending to the plane connection mass. + +For NN `p=1/4`, the observed splitting is numerically comparable to `w nu_w`: + +```text +Delta gamma_w/(w nu_w) + = 1.83, 1.69, 1.77, 1.94, 1.67 for w=3,...,7. +``` + +At other p/graphs the proportionality constant is very different, so no universal constant is claimed. A more plausible structural version is + +```text +Delta gamma_w = Theta_p(essential-component coverage/renewal intensity), +``` + +with `w nu_w` only a first proxy. + +A possible mechanism is a metastable two-sector transfer block: rare complete-topology events weakly couple two otherwise degenerate longitudinal sectors, producing a symmetric/antisymmetric splitting and the observed opposite residues. The physical sectors should be identified from the actual tagged states before this interpretation is promoted. + +## 8. What should be checked next + +1. Extract the two leading **visible** poles directly from the tagged resolvent/operator, with left/right source overlaps, rather than only from `d_h`. +2. Identify which tagged frontier states carry the two slow eigenvectors. +3. Compare `Delta gamma_w` to `nu_w E_Palm K`, `nu_w E_Palm L`, and other renewal/coverage intensities once #774 supplies the relevant moments. +4. Repeat the projected recurrence on the stored matching `p=1/8` sequence and any future width-8 span spectrum without rebuilding the transfer. +5. For #758, formulate the upper-bound/LDP proof directly in the simultaneous `h=A w` limit; the coalescing pair explains why a fixed-w single-pole shortcut is unsafe. + +## 9. Claim boundary + +- Data statement: the two-pole recurrence and residue diagnostics on the committed span spectra. +- Strong negative diagnostic: `xi_rel=o(w)` is incompatible with the observed width trend and should not be used as a proof assumption without a new mechanism that reverses it. +- Conjecture: exponential slow-mode coalescence / metastable two-sector interpretation and its relation to renewal intensity. +- Not claimed: a certified full transfer eigendecomposition, an asymptotic exponent for the splitting, or a modification of the #758 rate function. diff --git a/results/geometric-consistency/span-visible-pole-splitting-20260914.json b/results/geometric-consistency/span-visible-pole-splitting-20260914.json new file mode 100644 index 000000000..88051d5a4 --- /dev/null +++ b/results/geometric-consistency/span-visible-pole-splitting-20260914.json @@ -0,0 +1,27 @@ +{ + "schema": "matching-one/span-visible-pole-splitting/v1", + "date": "2026-09-14", + "source_path": "results/geometric-consistency/span-spectrum-20260913.json", + "source_sha": "58e070f814f290d1d6a7d10c00ab4273d671c5bb", + "method": "normalized second-order late recurrence starting at h=13 plus separate two-exponential residue fit", + "claim_boundary": "Projected/Prony diagnostic on an existing scalar sequence; not a certified full transfer eigendecomposition.", + "nn_p_1_4": [ + {"width":2,"rho1":0.29035945694,"rho2":0.18750000038,"delta_gamma":0.437340815,"relaxation_length":2.2865,"relaxation_length_over_width":1.143,"c2_over_c1":-0.9984}, + {"width":3,"rho1":0.32928891833,"rho2":0.30300474518,"delta_gamma":0.083187071,"relaxation_length":12.021,"relaxation_length_over_width":4.007,"c2_over_c1":-1.00485,"delta_gamma_over_w_nu":1.8256}, + {"width":4,"rho1":0.34453662879,"rho2":0.33436154796,"delta_gamma":0.029977523,"relaxation_length":33.358,"relaxation_length_over_width":8.340,"c2_over_c1":-1.02036,"delta_gamma_over_w_nu":1.6919,"gamma_eff_at_w":0.7790,"gamma_eff_at_2w":0.94357,"gamma1":1.06555}, + {"width":5,"rho1":0.35091375383,"rho2":0.34676672776,"delta_gamma":0.011888178,"relaxation_length":84.117,"relaxation_length_over_width":16.823,"c2_over_c1":-1.01527,"delta_gamma_over_w_nu":1.7687,"gamma_eff_at_w":0.78670,"gamma_eff_at_2w":0.93879,"gamma1":1.04721}, + {"width":6,"rho1":0.35356856032,"rho2":0.35183695653,"delta_gamma":0.004909537,"relaxation_length":203.685,"relaxation_length_over_width":33.948,"c2_over_c1":-1.00910,"delta_gamma_over_w_nu":1.9391,"gamma_eff_at_w":0.80418,"gamma_eff_at_2w":0.94399,"gamma1":1.03968}, + {"width":7,"rho1":0.35459715576,"rho2":0.35403420318,"delta_gamma":0.001588845,"relaxation_length":629.388,"relaxation_length_over_width":89.913,"c2_over_c1":-1.00377,"delta_gamma_over_w_nu":1.6737,"gamma_eff_at_w":0.82422,"gamma_eff_at_2w":0.95189,"gamma1":1.03677} + ], + "secondary_controls": [ + {"label":"NN p=1/8","width":6,"rho1":0.15331177010,"rho2":0.15328278242,"delta_gamma":0.00018909458,"relaxation_length":5288.36,"relaxation_length_over_width":881.39,"c2_over_c1":-1.000264,"max_recurrence_relative_residual":6.2e-11}, + {"label":"matching p=1/16","width":5,"rho1":0.18310566243,"rho2":0.18253656178,"delta_gamma":0.003112885,"relaxation_length":321.25,"relaxation_length_over_width":64.25,"c2_over_c1":-1.00365}, + {"label":"matching p=1/16","width":6,"rho1":0.18355402843,"rho2":0.18340223624,"delta_gamma":0.000827304,"relaxation_length":1208.75,"relaxation_length_over_width":201.46,"c2_over_c1":-1.00138} + ], + "verdicts": { + "single_pole_relaxation_o_w": "incompatible with current width trend", + "macroscopic_LDP_candidate": "not falsified", + "periodic_mass_locality_gamma_minus_kappa": "not falsified", + "recommended_interface": "coalescing slow visible subspace; analyze h=A w directly rather than assuming fixed-w Perron capture" + } +} diff --git a/scripts/span_visible_pole_splitting.py b/scripts/span_visible_pole_splitting.py new file mode 100644 index 000000000..18952dd08 --- /dev/null +++ b/scripts/span_visible_pole_splitting.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Projected two-pole diagnostic for complete-component span spectra. + +Reads the already generated span-spectrum JSON and does not rebuild a transfer +matrix. Fits d_{h+2}=S d_{h+1}-P d_h on a declared late window after dividing +each row by d_{h+1}, then fits the two exponential residues. +""" +from __future__ import annotations +import argparse, json, math +from pathlib import Path + + +def solve_2x2(a11,a12,a22,b1,b2): + det=a11*a22-a12*a12 + if abs(det)<1e-30: raise ArithmeticError("singular normal equations") + return ((b1*a22-b2*a12)/det,(a11*b2-a12*b1)/det) + + +def fit_recurrence(d,start_h=13): + rows=[] + for h in range(start_h,len(d)-1): + a,b,c=d[h-1],d[h],d[h+1] + if min(a,b,c)<=0: continue + rows.append((1.0,-a/b,c/b,h)) + if len(rows)<4: raise ValueError("too few late-window triples") + a11=sum(x*x for x,z,y,h in rows); a12=sum(x*z for x,z,y,h in rows); a22=sum(z*z for x,z,y,h in rows) + b1=sum(x*y for x,z,y,h in rows); b2=sum(z*y for x,z,y,h in rows) + S,P=solve_2x2(a11,a12,a22,b1,b2) + disc=S*S-4*P + if disc<=0: raise ArithmeticError("nonpositive recurrence discriminant") + rr=math.sqrt(disc); rho1=(S+rr)/2; rho2=(S-rr)/2 + if not (rho1>rho2>0): raise ArithmeticError("unexpected recurrence roots") + rec=[] + for x,z,y,h in rows: + pred=S+z*P; rec.append(abs(pred-y)/abs(y)) + + q=rho2/rho1; xs=[]; ys=[]; hs=[] + for h in range(start_h,len(d)+1): + val=d[h-1] + if val<=0: continue + xs.append(q**(h-1)); ys.append(val/(rho1**(h-1))); hs.append(h) + n=len(xs); sx=sum(xs); sxx=sum(x*x for x in xs); sy=sum(ys); sxy=sum(x*y for x,y in zip(xs,ys)) + c1,c2=solve_2x2(float(n),sx,sxx,sy,sxy) + fit=[] + for h in hs: + val=d[h-1]; pred=c1*rho1**(h-1)+c2*rho2**(h-1); fit.append(abs(pred-val)/val) + dg=math.log(rho1/rho2) + return {"start_h":start_h,"rho1":rho1,"rho2":rho2,"gamma1":-math.log(rho1),"gamma2":-math.log(rho2), + "delta_gamma":dg,"relaxation_length":1/dg,"c1":c1,"c2":c2,"c2_over_c1":c2/c1, + "max_recurrence_relative_residual":max(rec),"max_two_exp_relative_residual":max(fit)} + + +def tail_hazard(d,tail,h): + if h<1 or h>=len(d)+1: return None + t0=sum(d[h-1:])+tail; t1=sum(d[h:])+tail + return -math.log(t1/t0) if t0>0 and t1>0 else None + + +def run_record(rec,start_h): + d=[float(x) for x in rec["d_h_float"]]; fit=fit_recurrence(d,start_h); w=int(rec["width"]); nu=float(rec.get("nu_total_float",sum(d))) + return {"label":rec.get("label"),"width":w,"matching":bool(rec.get("matching")),"p":rec.get("p"),"d_max":len(d),"nu":nu,**fit, + "relaxation_length_over_width":fit["relaxation_length"]/w, + "delta_gamma_over_w_nu":fit["delta_gamma"]/(w*nu) if nu>0 else None, + "gamma_eff_at_w":tail_hazard(d,float(rec.get("tail_bin_float",0.0)),w), + "gamma_eff_at_2w":tail_hazard(d,float(rec.get("tail_bin_float",0.0)),2*w)} + + +def main(): + ap=argparse.ArgumentParser(); ap.add_argument("--input",required=True); ap.add_argument("--start-h",type=int,default=13); ap.add_argument("--output") + a=ap.parse_args(); payload=json.loads(Path(a.input).read_text()); rows=[]; errors=[] + for rec in payload["runs"]: + try: rows.append(run_record(rec,a.start_h)) + except Exception as exc: errors.append({"label":rec.get("label"),"width":rec.get("width"),"matching":rec.get("matching"),"p":rec.get("p"),"error":str(exc)}) + out={"schema":"matching-one/span-visible-pole-splitting/v1","source":a.input,"start_h":a.start_h, + "method":"normalized second-order recurrence + two-exponential residue fit","rows":rows,"errors":errors, + "claim_boundary":"Projected/Prony diagnostic only; not a certified full transfer eigendecomposition."} + txt=json.dumps(out,indent=2) + if a.output: Path(a.output).write_text(txt+"\n") + print(txt) +if __name__=="__main__": main()