caelum0x 771f89b099 feat(v2-A/v2-B): weak-form, implicit dynamics, FROLS/SSR/trapping, SRBench harness
Four expansion-v2 items (finished after a session-limit interruption):

Weak/integral-form discovery (crates/lawsynth-weakform, specs/weak-form) — the top
noise-robustness technique from PySINDy: integrate candidates against compactly-
supported test functions, NO differentiation of noisy data. ~23x lower coefficient
error than finite-difference strong-form under noise. 20 tests, deterministic.

Implicit/rational dynamics (crates/lawsynth-implicit, specs/implicit-dynamics) —
SINDy-PI alternating-LHS nullspace solve; recovers rational laws (Michaelis-Menten)
explicit regression can't express. Honest degree-2 identifiability limit documented
(multi-dimensional nullspace); residual-floor + derivative-preferring tie-break for
canonical selection. 10 tests.

Optimizer breadth (lawsynth-sparse) — FROLS (orthogonal-least-squares, ERR
ordering), SSR (stepwise), trapping (stability-biased); --solver frols|ssr|trapping.
24 tests; default path byte-identical.

SRBench harness (benchmarks/) — 18 Strogatz ODE systems + scoring + a determinism
column (byte-identical on replay — a metric no stochastic competitor can report).
3/3 Strogatz recovered at R²=1.0. srbench_report.py + 5 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-18 14:49:27 +03:00

50 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Implicit / rational dynamics boundary (v2-A)
This directory specifies implicit and rational dynamics discovery — the SINDy-PI
style method implemented in `crates/lawsynth-implicit`, which recovers relations
`f(x, ẋ) = 0` (including rational laws `ẋ = P(x)/Q(x)`) that explicit
`ẋ = Θ(x)Ξ` regression cannot express. It is a **boundary specification**.
## Method
Build an augmented candidate library `Θ(x, ẋ)` — monomials in the states, plus
those monomials multiplied by the target derivative ẋ. A rational law
`ẋ = P(x)/Q(x)` is equivalent to the implicit relation `Q(x)·ẋ − P(x) = 0`, i.e.
a sparse vector ξ with `Θ(x, ẋ) · ξ ≈ 0`. Discovery finds that sparse nonzero ξ.
## Requirements
1. **Nontrivial solution.** ξ = 0 trivially satisfies `Θξ = 0` and MUST be
excluded. The reference uses the SINDy-PI alternating-LHS scheme: for each
candidate column j, normalise its coefficient to 1 (move it to the LHS) and
solve a sparse regression for the remainder; a left-hand side whose column is
identically zero MUST be skipped.
2. **Selection.** Among candidate LHS choices, selection MUST be deterministic.
Near-perfect fits (relative residual below a fixed tolerance) MUST be treated
as tied so that machine-level residual noise does not decide the outcome;
ties break toward fewer active terms, then toward a **derivative-bearing** LHS
(so the chosen relation is affine in ẋ and reconstructs the canonical
`Q(x)·ẋ = P(x)`), then toward the earlier library index.
3. **Explicit reconstruction.** When the relation is affine in ẋ, the
implementation MUST reconstruct the explicit rational law `ẋ = P(x)/Q(x)` and
report whether Q(x) is non-vanishing over the observed window (a pole makes the
explicit form invalid there).
4. **Determinism.** Identical inputs MUST yield bit-identical output.
## Honest identifiability limit
Implicit discovery has a genuine identifiability limit: **at library degree ≥ 2
the augmented nullspace is multi-dimensional.** If `r(x, ẋ) = 0` is the true
relation, then `m(x)·r(x, ẋ) = 0` for any monomial `m(x)` also fits to machine
precision. Therefore an implementation is NOT guaranteed to return the minimal,
spurious-free relation at higher degree. The achievable, conforming guarantee is:
- the returned relation is a **valid** member of the nullspace (fits to
tolerance) and, when affine in ẋ, reconstructs an explicit rational law that
**reproduces the true derivative** across the observed window; and
- at the **minimal degree** (a one-dimensional nullspace) the clean, spurious-free
law is recovered.
An implementation MUST NOT claim minimal-form recovery at higher degree; it MUST
document this limit (as the reference's degree-2 test does).