Follow-up to #357 / PR #437.
limit_result::direction (include/numsim_cas/core/limit_result.h) has no value for "converges to a finite limit whose sign is not provable". The only sound answer for such a case is unknown, which downstream also means "might be infinite" — so boundedness information is lost, not just the sign.
Confirmed losses (adversarial review of #437, probes run against the branch):
| Expression |
True limit |
Reported |
x + y as x → +∞, y unassumed |
+∞ (y is finite) |
unknown |
exp(y), y unassumed |
finite positive |
unknown |
abs(y), y·y |
finite, ≥ 0 |
unknown |
unassumed symbol y |
finite |
unknown |
Before #357 these returned finite_positive — definite but unsound (y may be negative). #437 traded that fabrication for unknown, which is sound but coarse; the user accepted that trade deliberately, with this issue as the follow-up.
Proposal: add direction::finite (converges, sign unknown) and treat it as finite everywhere finiteness is what matters:
- symbols and sign-unknown finite results report
finite instead of unknown;
combine_add: finite_positive + finite_negative → finite; finite ± finite → finite; pos_infinity + finite → pos_infinity (this is the case that currently degrades);
combine_mul, apply_pow, apply_log, apply_reciprocal: propagate finite, but never claim a sign from it — 1/finite is finite only when the value is also known nonzero, otherwise unknown;
- any
is_finite-style predicate counts finite;
- t2s limit visitor mirrors the scalar rules.
direction is public API, so this is a deliberate enum extension: every switch over it must be revisited (the compiler finds them if no default is present — check limit_algebra.cpp, scalar_limit_visitor.cpp, tensor_to_scalar_limit_visitor.cpp).
Soundness rule stays: a reported direction must be true for every value consistent with the assumptions. finite claims convergence only where convergence is provable — an unassumed symbol is finite because it is a fixed real, not because the sign is unknown.
Tests: the table above, plus the two cases #437 changed (ScalarLimit.OtherVariableFinite, T2sLimit.TensorDepIndependentExpr), which would move from unknown to finite.
Signed-off-by: petlenz peterlenz89.pl@gmail.com
Follow-up to #357 / PR #437.
limit_result::direction(include/numsim_cas/core/limit_result.h) has no value for "converges to a finite limit whose sign is not provable". The only sound answer for such a case isunknown, which downstream also means "might be infinite" — so boundedness information is lost, not just the sign.Confirmed losses (adversarial review of #437, probes run against the branch):
x + yas x → +∞,yunassumedunknownexp(y),yunassumedunknownabs(y),y·yunknownyunknownBefore #357 these returned
finite_positive— definite but unsound (y may be negative). #437 traded that fabrication forunknown, which is sound but coarse; the user accepted that trade deliberately, with this issue as the follow-up.Proposal: add
direction::finite(converges, sign unknown) and treat it as finite everywhere finiteness is what matters:finiteinstead ofunknown;combine_add:finite_positive + finite_negative → finite;finite ± finite → finite;pos_infinity + finite → pos_infinity(this is the case that currently degrades);combine_mul,apply_pow,apply_log,apply_reciprocal: propagatefinite, but never claim a sign from it —1/finiteisfiniteonly when the value is also known nonzero, otherwiseunknown;is_finite-style predicate countsfinite;directionis public API, so this is a deliberate enum extension: every switch over it must be revisited (the compiler finds them if nodefaultis present — checklimit_algebra.cpp,scalar_limit_visitor.cpp,tensor_to_scalar_limit_visitor.cpp).Soundness rule stays: a reported direction must be true for every value consistent with the assumptions.
finiteclaims convergence only where convergence is provable — an unassumed symbol is finite because it is a fixed real, not because the sign is unknown.Tests: the table above, plus the two cases #437 changed (
ScalarLimit.OtherVariableFinite,T2sLimit.TensorDepIndependentExpr), which would move fromunknowntofinite.Signed-off-by: petlenz peterlenz89.pl@gmail.com