Batch 3 of the expansion-v2 roadmap, all deterministic/offline/std-only with honest capability boundaries. crates/lawsynth-reduce (new): deterministic symmetry & separability detection. Numerical-derivative probe (finite differences replace AI-Feynman's trained NN gradients) over a reconstructed Cartesian grid; additive/multiplicative separability + difference/sum/product/ratio symmetries. Every detection is a HYPOTHESIS verified by reconstruction residual, never a proof; non-grid data is honestly rejected (NotReconstructed). 17 tests. crates/lawsynth-score: two-part MDL objective (L_data + L_model in nats) and O(n log n) pareto_front_2d (sort-then-sweep), verified equal to the O(n^2) front across 12 deterministic sets. +5 tests; crate fmt-normalized to config. python/lawsynth export.py (new): to_sympy/to_torch/to_jax + dep-free numeric_derivatives anchor. Constants+params hoisted into one trainable vector so autograd reaches every coefficient (Neural-ODE vector field). Backends absent here degrade gracefully (MissingDependencyError subclasses ImportError). Faithful to native simulate at 1.1e-16. 10 tests + 6 honest skips. benchmarks: SRBench Feynman (15: 12 static algebraic relations as honest capability-boundaries, 3 dynamics-framed ODEs executed at R2~=1.0) and black-box (4 systems, predictive R2 + parsimony, no ground truth) families. Fixes a pre-existing _runner.py failure where Strogatz cases leaked into the legacy contract suite. 31 benchmark tests. specs/structural-reductions: boundary spec (detection-is-a-hypothesis contract).
Structural reductions boundary (v2-A)
This directory specifies deterministic symmetry & separability reductions —
the structural pre-analysis implemented in crates/lawsynth-reduce. It is a
boundary specification in the house style: it states what a conforming
implementation MUST do, and — crucially — what a detected reduction is and is not
allowed to claim.
Motivation
AI-Feynman shrinks combinatorial symbolic search by structurally reducing a
target f(x1..xn) before searching: dimensional analysis, then symmetry,
then separability (additive f = g(A) + h(B) / multiplicative f = g(A)·h(B))
split an n-variable problem into smaller independent sub-problems
(divide-and-conquer). Each reduction that holds removes whole regions of the
search space.
AI-Feynman detects these structures by probing a trained neural network that
interpolates the data, then querying its gradients. LawSynth is deterministic
and offline and ships no trained probe. Instead this crate uses the data's own
numerical partial derivatives — the finite-difference / three-point
derivatives already provided by crates/lawsynth-differentiate — evaluated on
the reconstructed sample grid. The differentiation is exact-arithmetic
deterministic, so the whole reduction pipeline preserves the reproducibility
contract: identical inputs MUST yield bit-identical output.
What a reduction IS
A detected reduction is a HYPOTHESIS about structure, never a proof. The contract is:
- Detection is a screening test. Separability is screened by estimating a
mixed second partial
∂²f/∂x_i∂x_jnumerically across a candidate partition and testing whether it is ≈ 0 (additive), or the mixed partial oflog|f|is ≈ 0 (multiplicative). Symmetry is screened by first-derivative invariance under a coordinated transform (see below). A screen that passes only makes the structure a candidate. - Every detection MUST be verified. A screened reduction MUST be checked by
reconstructing the data from the reduced form and measuring how well it
reproduces the observations (a relative RMS residual, i.e.
1 − R²of the reconstruction). A reduction is only reported when both the screen and the verification pass their tolerances. - Honest reporting. Every reported reduction MUST carry its screening
residual, its reconstruction residual, and a confidence derived from the
reconstruction (
confidence = 1 − reconstruction_residual, clamped to[0,1]). A reduction MUST NOT be asserted as an established fact; it is a ranked, quantified hypothesis for a downstream divide-and-conquer stage. - No spurious claims. On data with no structure (e.g.
f = x·y + sin(x+y)), a conforming implementation MUST report nothing above tolerance. Silence is a valid and required answer.
Requirements
- Determinism. Grid reconstruction (distinct-value detection, cell
ordering), differentiation, residual aggregation (fixed iteration order), and
partition enumeration MUST be deterministic. No hashing with a randomized
seed, no floating-point reduction whose order depends on iteration nondeterminism.
Identical
(Dataset, ReduceConfig)inputs MUST produce a bit-identicalReductionReport. - Numerical derivatives, not a learned probe. All gradient / mixed-partial
estimates MUST come from the deterministic derivative estimators in
lawsynth-differentiateapplied along reconstructed grid axes. No trained surrogate model is used or required. - Grid reconstruction, honestly gated. Detection requires the input columns
to form a full Cartesian (tensor) grid so that partials along one variable can
be estimated with the others held fixed. An implementation MUST attempt to
reconstruct such a grid from the samples and, if the samples do not form a
complete grid (missing cells, duplicates, too few distinct values per axis),
MUST report
GridStatus::NotReconstructedwith a reason and detect nothing — never fabricate a partial from scattered data. - Separability. For a bipartition
(A, B)of the input variables:- Additive
f = g(A) + h(B)is screened by requiring every cross mixed partial∂²f/∂x_i∂x_j(i∈A, j∈B) to be ≈ 0, and verified by the additive (two-way main-effects) reconstructionf̂ = mean_B f + mean_A f − mean f. - Multiplicative
f = g(A)·h(B)is screened and verified identically onlog|f|, and is only attempted whenfis sign-consistent and bounded away from zero on the grid (otherwise reported as not applicable, not as absent).
- Additive
- Symmetry. For a variable pair
(x, y), four simple symmetries are screened from first partialsf_x, f_y(all deterministic invariance tests):Symmetry fdepends only onInvariant (≈ 0) Difference x − yf_x + f_ySum x + yf_x − f_yProduct x · yx·f_x − y·f_yRatio x / yx·f_x + y·f_yEach residual is normalized by the gradient scale and reported with a confidence. - Honest scope & limits. Detection is inherently tolerance- and
noise-limited: numerical mixed partials amplify noise, coarse or short axes
raise the residual floor, and a large tolerance risks false positives while a
small one risks false negatives. The implementation MUST expose these
tolerances in
ReduceConfig, MUST document that reductions are hypotheses, and MUST NOT silently widen tolerances to force a detection.
Public API
detect_reductions(&Dataset, &ReduceConfig) -> Result<ReductionReport, ReduceError>
ReductionReport lists the detected separabilities (kind, partition, screening
residual, reconstruction residual, confidence) and symmetries (pair, kind,
residual, confidence), plus the grid status. These reductions are intended to
feed a later divide-and-conquer discovery stage; this crate delivers the
detection library and honest reporting only — wiring into the discovery
pipeline is a follow-up and is out of scope here.
Non-goals
- No trained/neural probe, no stochastic sampling, no network or platform service.
- No PDE / spatiotemporal reductions; the boundary is scalar
f(x1..xn)sampled on a Cartesian grid (or a per-state derivative surface presented as such). - No claim of proof: a reduction is a verifiable, quantified hypothesis.