You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ltm: polarity analysis returns Unknown for all array reducers #480
analyze_expr_polarity_with_context in src/simlin-engine/src/ltm.rs only handles the scalar two-arg forms Max(a, Some(b)) and Min(a, Some(b)). Every array reducer (Sum, Mean, Max(_, None), Min(_, None), Stddev, Rank) falls through the catch-all Expr2::App(_, _, _) => LinkPolarity::Unknown arm. Any variable computed via SUM(x[*]) or MEAN(x[*]) therefore contributes Unknown polarity, and every loop crossing such a node is classified Undetermined.
Why this matters
For Sum and Mean, polarity is trivially the argument's polarity (monotone in every element), so an entire class of arrayed feedback loops is misclassified as undetermined when their polarity is in fact recoverable.
Locations
src/simlin-engine/src/ltm.rs:2042-2075 -- the polarity analyzer with the catch-all Unknown
Add explicit cases in the polarity match: pass through the argument's polarity for Sum and Mean; return Unknown for Stddev and Rank (which have no monotone polarity).
For array Max(_, None) / Min(_, None), return the argument's polarity (max/min of a monotone family is monotone).
Consider a plateau-tolerant GF monotonicity check that ignores noise below a configurable epsilon rather than the strict 1e-10.
Activity
doc: link LTM tech-debt and engine CLAUDE.md to GitHub tracking epic
engine: handle array reducer polarity in ltm analyzer
engine: handle expr2 subscript in polarity analyzer
engine: cover array reducer and variadic mean polarity in unit tests
engine: assert sum(x[*]) link polarity in cross-dim integration test