fix: make D17 gap-rate consistency dimension-coherent (#69) - #79
Conversation
D17 was |beta_D - Delta| / Delta, comparing the RELATIVE-ENTROPY fit rate
beta_D directly with the spectral gap Delta. Relative entropy near the steady
state pi is quadratic in (rho - pi) for a faithful (full-rank) pi -> decays at
2*Delta; for a rank-deficient pi the null-space-leakage term is linear ->
decays at 1*Delta. That metric multiplier m in {1,2} (empirically 2.0 for
faithful pi V1/V2/V4, 1.05 for rank-deficient pi V3/V5) inflated D17
(dephasing ~3.3, amp-damp ~1.1) and made the A1 "gap-controlled" label
unreachable for every system.
Fix: D17 now uses beta_D_linear, the dominant decay rate of the LINEAR
trace-distance curve (LIOU-F-018), fit with the same M0-M3b/AICc machinery.
A linear distance metric decays at the bare mode rate, so it is
dimension-coherent with Delta. The relative-entropy beta_D (headline rate) and
the fit/bootstrap/anchor pipeline are untouched. The classifier exposes beta_D,
beta_D_linear, gap and the implied multiplier d17_metric_multiplier in the
evidence dict (explicit + auditable), and a strong-gap-controlled early branch
(D17<0.05 AND single-exponential linear fit) lets a genuine textbook system
earn A1/F1. No V1-V5 mechanism label changes; only the D17 number is corrected.
- RelaxationResult.beta_D_linear/linear_fit_model, LepResult.beta_D_linear
(additive, defaulted -> serialised reports stay valid)
- compute_lep_layer(beta_D=) -> (beta_D_linear=); gap_rate_consistency param
beta_D -> rate (both internal)
- new tests/test_validation_systems/test_d17_gap_coherence.py (14 e2e tests;
previously classification had only synthetic-evidence unit tests)
Anchor regressions untouched (test_anchors.py pins D16, not D17).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…69) Equalita #79 adversarial review found two blocking issues; both valid. Befund 1 (regression risk, #68 class): the new A1 early-branch fired BEFORE the F1-F5 gap-failure families. gap_rate_consistency + linear_fit_model come from the initial-state-DEPENDENT trace-distance curve, whereas pseudospectral_radius/henrici/trans_amplitude/kreiss/petermann are operator-INTRINSIC. A strongly non-normal phantom/skin operator with an rho_0 exciting only the slow gap mode yields a clean single-exp at the gap rate and would have been mislabelled A1/F1 CONFIRMED/PUBLICATION_GRADE, shadowing the true A10/F5 (or A4/F2) mechanism. Fix (Option b, cleaner): move the A1 early-branch to AFTER F5/F1/F2/F3 and only BEFORE the relative-entropy-SHAPE branches (M2/M3a/M3b) -- exactly the stated intent (A1 priority over the shape branches) without shadowing the real non-normality families. A1 "gap-controlled" is awarded only when no gap-failure family fires. Verified: constructed d=4 non-normal phantom ladder (henrici 4.2, pseudospec 2.15 > 2*gap_to_gns 2.0) with a slow-mode-aligned rho_0 (D17=0.0000, single-exp) is now classified A10/F5, not A1. Befund 2 (test gap): the "no V1-V5 label change" claim was unpinned. Added end-to-end a_class golden asserts for V1-V5 (full pipeline). Measured on main (baseline 3fef6a1) vs this branch: IDENTICAL -- V1 A5, V2 A11, V3 A5, V4 A5, V5 A11. No flip. Claim now golden-pinned. - tests/test_classification.py: +3 synthetic ordering regressions (A1-early reached when no gap-failure; A1-early does NOT shadow F5 phantom; ...does not shadow F2 skin) - tests/test_validation_systems/test_d17_gap_coherence.py: +V1-V5 a_class golden (5) + adversarial non-normal-phantom shadow test (1) -> 20 tests total Local CI chain green: ruff pass, mypy 50 files, anchors 21, full+cov 450 passed / 94.39%, qutip 8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Equalita #79 review — both blocking findings addressed (commit 723ee50)Befund 1 (shadowing, #68 class) — Option b (reorder), chosen for cleanliness. Adversarial construction (physical, now a test): d=4 directional-ladder phantom, Befund 2 (unpinned claim) — V1-V5 a_class golden-pinned end-to-end.
No flip. The "no label change" claim is now pinned by New tests: Local CI chain (identical to workflows): ruff pass · mypy 50 files · anchors 21 · full+cov 450 passed / 94.39% · qutip 8. Real numbers. Not merged — awaiting Equalita re-verify + Cross-Family. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 723ee5005f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # check (D17) must use. (_dominant_rate is fail-closed: it returns nan if | ||
| # every model fit fails, so D17 then reads "unknown" rather than a spurious | ||
| # match.) | ||
| beta_D_linear, linear_fit_model = _dominant_rate(t_grid, trace_distance_curve) |
There was a problem hiding this comment.
Treat zero trace-distance curves as undefined
When rho_initial is already the steady state (or the trace-distance curve is otherwise all numerical zero), this still sends a no-signal curve through the fitter. The exponential parameters are then underdetermined and the rate stays at a seed value (e.g. 1.0 or 0.001), so beta_D_linear, D17, and any downstream A1 evidence are fabricated rather than marked unknown. Please short-circuit near-zero trace-distance curves to (nan, "none") before fitting.
Useful? React with 👍 / 👎.
| if ( | ||
| ev.get("gap_rate_consistency", float("inf")) < 0.05 | ||
| and ev.get("d17_linear_single_exp", 0.0) > 0.5 | ||
| ): |
There was a problem hiding this comment.
Require M1 offsets to be negligible before A1
When the trace-distance fit wins M1, the curve is A exp(-alpha t) + C, so a real nonzero offset/plateau is not a single exponential relaxation to the supplied steady state. In contexts with a non-primitive Liouvillian or a caller-supplied steady state that is not the attracting component, gap_rate_consistency < 0.05 plus an M1 plateau can now award A1/CONFIRMED even though the observable distance does not decay to zero; either restrict this early branch to M0 or store/check that the M1 offset is numerically negligible.
Useful? React with 👍 / 👎.
|
|
||
| def gap_rate_consistency(beta_D: float, gap: float) -> float: | ||
| """D17: ``|beta_D - Delta| / Delta``. Returns inf if gap is zero.""" | ||
| def gap_rate_consistency(rate: float, gap: float) -> float: |
There was a problem hiding this comment.
Update citation metadata for D17 methodology change
This change redefines D17 from comparing the relative-entropy rate to comparing a trace-distance rate, which is a methodology/results change. The repository instructions in AGENTS.md state that “changes touching results or methodology must update CITATION.cff,” but this commit has no CITATION.cff diff, so the public citation metadata will lag the reported diagnostic semantics.
Useful? React with 👍 / 👎.
…gap certificate (#80) (#90) The A1 early branch awarded CONFIRMED/PUBLICATION_GRADE (0.95) whenever gap_rate_consistency < 0.05 + single-exp held and none of the F1-F5 thresholds fired -- resting a publication-grade claim on the unprovable exhaustiveness of the threshold set (residual flagged independently by both #79 reviewers). A weakly-non-normal gap failure below all thresholds with a single-exp-at-gap trajectory would have self-certified. Fix (issue #80 to-do 2, burden of proof reversed): - new evidence key sym_gap_corroborated: 1.0 iff a MEASURED symmetrised gap shows no F3-grade reduction (certified GNS gap_to_gns_ratio <= 1.2, or KMS gap_to_kms_ratio <= 1.2), fail-closed on floored/uncertified gaps - A1 confidence: 0.95 only with the certificate; uncorroborated A1 caps at 0.70 -> CANDIDATE/CONFIRMATION - gap_to_kms_ratio graduates from advisory (#89) to class-influencing; an F3 veto off it stays deferred to its own FP study Anchor-preserving: the gap-controlled thermal reference has Delta_GNS = Delta_KMS = Delta exactly (stays 0.95/CONFIRMED); V1-V5 golden labels (A5/A11) never take the A1 confidence path. New synthetic adversary, KMS-certificate and double-floored fail-closed tests. Gates: pytest 489 passed (anchors 21/21 incl. QuTiP), ruff clean, mypy clean. claim_status: pending until cross-family review confirms the semantics. Claude-Session: https://claude.ai/code/session_01BuG9j9cRJ6x6QMuYk7vXdx Co-authored-by: Claude <noreply@anthropic.com>
Summary
Fixes #69. D17 gap-rate consistency was dimensionally incoherent: it compared the relative-entropy fit rate
beta_Ddirectly with the spectral gapDelta, so a metric multiplier contaminated the number and made the A1 "gap-controlled" label unreachable for every system (feeding the #68 problem).The physics (empirically verified, not assumed)
Near the steady state
pi, writerho(t) = pi + delta(t),delta ~ e^{-Delta t}.1-F) decay at the bare mode rateDelta.D(rho||pi)is the wrong dimension: its gradient vanishes at the minimiserpi, so for a faithful (full-rank)piit is quadratic indelta-> decays at2*Delta. For a rank-deficientpithe null-space-leakage term-Tr rho log piis linear -> decays at1*Delta.The factor is regime-dependent, NOT a universal 2 — this is exactly why option (2) (hardcode
2*Delta) would be wrong. Measured decay-rate ratior_D / r_Td(relative-entropy rate / trace-distance rate) across V1-V5, and the full-pipeline metric multiplierm = beta_D / beta_D_linear:rank(pi)r_D/r_Td(tail)mm ~ 2for faithfulpi,m ~ 1for rank-deficientpi— clean split, matching theory. (There is also a second, independent confounder — the initial state can skip the slowest spectral mode; that is a genuine non-gap-controlled signal D17 must keep, and it does.)Chosen option — (3), explicit + dimension-coherent
Option (2) (compare to
2*Delta) hides a regime-dependent factor and is wrong for rank-deficientpi. Instead:beta_D_linear= dominant rate of the linear trace-distance curve (LIOU-F-018), fit with the same M0-M3b/AICc machinery. A linear metric always decays at the bare mode rate, sobeta_D_linearis dimension-coherent withDelta— regime-independent, no discontinuous rank heuristic.beta_D(headline relaxation rate) and the entire fit/bootstrap/anchor pipeline are untouched.beta_D,beta_D_linear,gap, andd17_metric_multiplier = beta_D/beta_D_linear. Nothing is hidden.D17 < 0.05AND the observable relaxation is a single exponential) lets a genuine textbook system earn A1/F1, overriding the relative-entropy-shape-driven M2/A5 branch (that curve's quadratic-metric curvature can prefer a bi-exponential even for single-mode dynamics).Verdict changes (full pipeline,
bootstrap_B=30, seed=42)DeltaNo V1-V5 mechanism label changes — none of them is a single-mode gap-controlled system (they mode-skip or are Mpemba/multi-timescale), which is the honest outcome. Only the D17 number is corrected (dimensionally deflated). A1 is now reachable: the new textbook reference (faithful
pi, fast dephasing so the population mode is the gap, diagonal initial state overlapping it) earns A1/F1. A1 thresholds unchanged (0.05 / 0.20) — the dimension correction did not require moving them.Test plan
ruff check src tests benchmarks-> exit 0mypy src/liouscope-> Success, 50 filespytest tests/test_anchors.py -v-> 21 passed (anchors pin D16, not D17 — untouched)pytest --cov=liouscope --cov-fail-under=80-> 442 passed, coverage 94.39%pytest -m qutip(cross-check) -> 8 passedpython .github/scripts/check_workflow_hardening.py-> exit 0;check_claim_safety.py-> exit 0python examples/quickstart.py-> smoke OKtests/test_validation_systems/test_d17_gap_coherence.py-> 20 passed (e2e V1-V5 dimension-coherence + faithful/rank-deficient multiplier split + gap-controlled reference reaches A1 + old-formula-would-have-failed regression). This is the end-to-end classification coverage that was previously absent (only synthetic evidence dicts existed).Notes
test_anchors.pypins D16lep_proximity, not D17; all 21 green.0.5.0,date-released 2026-06-25); this is an[Unreleased]change, consistent with the other[Unreleased]methodology entries (D21-D23, claim gates) which also did not touch it. CITATION bump belongs to the next release gate.Draft until Equalita (+ Cross-Family, HIGH / canonical physics) verify. Do not merge on CI alone.
🤖 Generated with Claude Code