Repository navigation
Conversation
trace, norm and det gated rank with an assert, so NDEBUG built a malformed node that reached the evaluator. They now throw invalid_expression_error through the same helper the tensor side uses, which also makes the rank preconditions the trace rules rely on hold in release builds. Signed-off-by: petlenz <peterlenz89.pl@gmail.com>
sqrt claimed nonnegative and real for any argument, and a fractional power claimed real whenever base and exponent were real, though both are NaN on a provably negative operand. An unknown-sign operand keeps the claims, since unassumed symbols are real by default here. Signed-off-by: petlenz <peterlenz89.pl@gmail.com>
…ative Composed negativity escaped the radicand guard: -(x*x)-1 concluded only nonpositive, so sqrt of it still claimed nonnegative and real though the value is NaN for every real x. A sum now concludes a strict sign when every term shares it weakly and at least one holds it strictly. Signed-off-by: petlenz <peterlenz89.pl@gmail.com>
This was referenced Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #439.
Closes #447.
#439 — t2s invariants reject a wrong-rank operand.
trace,normanddetgated rank withassert, so an NDEBUG build constructed a malformed node that reached the evaluator. They now throwinvalid_expression_errorthrough the samevalidate_rankhelper the tensor side uses (#438), anddot's hand-written check moved onto it too.Side benefit: the rules added in #427 rely on
trace's rank precondition —try_trace_identityassumes a rank-2 identity,try_trace_outer_productassumes rank-1 operands. A real throw makes those preconditions hold in release builds as well; verified thattrace(I4)andtrace(otimes(X,X))(rank 4) both throw.#447 — no real-domain claims for a negative radicand.
sqrtclaimednonnegative+realfor any argument, andpowclaimedrealwhenever base and exponent were real, though both are NaN on a provably negative operand. Now suppressed when the base is provably negative and the exponent is provably fractional — including a negated fractional exponent (pow(n, -1/2)) and adoublespelling (0.5), both verified by probe.Deliberate scope: an unknown-sign operand keeps the claims, since unassumed symbols are real by default in this propagator. Tightening that would mean
sqrt(x)on an unassumedxclaims nothing, a broader policy change than this issue.Negative controls:
trace(C),trace(u)andnorm(C)on wrong-rank operands "throw nothing"; with it,T2sShapeValidation.InvariantsRejectNonRank2passes.AssumptionFixture.NoDomainClaimsForNegativeRadicandfails without the fix.Full suite 2407/2407 (gcc-14 Debug) plus a Release build; clang-format clean.
Authoring note: the agent that wrote these changes was interrupted by a rate limit mid-review. Its in-progress probe (the negated-exponent hole it suspected, and the #427 preconditions) was completed — both came back clean — the probe file removed, and the verification above run against the finished branch.