Repository navigation
A piecewise is defined where the case it takes is - #1819
Merged
Rafael-SOWNet merged 1 commit intoOct 7, 2026
Merged
Conversation
Its domain condition asked every case's predicate to be defined, and an ordering is defined only between reals. Fixes #1817. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.
Fixes #1817. Part of #718.
A piecewise is defined where the case it takes is, but its
DomainConditionwas the disjunction of the predicates and the domain condition of every child, andc < 0is defined only wherecis real:c21de3efpiecewise(1 provided not i in RR, 2 provided i < 0)falsefalsetruepiecewise(2 * x provided not x = 0, 3 * x ^ 2 provided i - 1 < 0)falsefalsenot x = 0Piecewise.InnerSimplifyalready passes over a predicate that evaluates toNaN; the domain condition did not. It reached integration through substitutions that carry the domain condition of the answer they found back with them:1/(sqrt(a + i a x) (c + d x)^(3/2) (a - i a x))is answered on master with an arm for each sign of a discriminant and one for its not being real, underprovided ... and 8 a^3 c - 8 i a^3 d in RR-- an answer with no value at any real point. It is answered here, 3,267 characters, and differentiates back.What changes.
DomainConditionof aPiecewiseis now the disjunction over its cases of: the case's predicate, its expression's domain condition, and for every earlier case, that its predicate does not hold or has no value. A case whose predicate evaluates toNaNorfalseis never taken and is left out. The earlier cases are kept in each term so that a case taken where its expression is undefined leaves the piecewise undefined there:piecewise(1/x provided x > -1, 0 provided true)is undefined at 0, not defined because the second case would hold.Tests:
UndefinedPiecewiseConditionTestgains the domain of four piecewises, one with an arm for a quantity off the real line at two points, and the first-case-decides case above at three.Measured on every corpus problem with
iin its integrand, 2,253 of them, and on the Rubi corpus, against masterc21de3efat the corpus's 5-second budget: no verdict changes anywhere -- 2,002 solved on both in the pocket, 1782, 1341 and 2328 in families 0, 1 and 2 to 8 sampled -- and the time on the problems both answer is the same, 2,099 seconds and 2,097.The suite passes on
2d3bf4e9, this change onc21de3ef: 15,146 passed, 13 skipped, none failed. Rebased onto77899a6fwithout a conflict, the domain and piecewise tests pass again. The allocation gate passes: every gated benchmark allocates what the baseline says. The library builds for every target.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura