Repository navigation
A piecewise case whose condition is undefined is passed over - #1764
Merged
Rafael-SOWNet merged 2 commits intoOct 5, 2026
Merged
Rafael-SOWNet merged 2 commits into
Rafael-SOWNet merged 2 commits into
Conversation
A case whose predicate evaluates to NaN -- an order comparison of a number off the real line, i < 0 -- made the whole piecewise NaN, even where another case held. It holds no more than a false predicate does: the case is never taken, and the cases after it are read as before. The derivative of an antiderivative with an arm for each sign of a quantity that is not real came out NaN that way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…ose-condition-is-undefined-never-holds
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.
A piecewise case whose predicate evaluates to NaN made the whole piecewise NaN, even where another case held:
a4141483piecewise(1 provided i < 0, 2 provided 1 > 0), inner-simplifiedNaNNaN2piecewise(2 * x provided not x = 0, 3 * x ^ 2 provided i - 1 < 0), inner-simplifiedNaNNaNpiecewise(2 * x provided not x = 0)piecewise(1 provided i < 0, 2 provided i > 0), inner-simplifiedNaNNaNNaN, as before: no case holdsAn order comparison of a number off the real line,
i < 0, evaluates to NaN, the complex numbers not being ordered, and that is right. But a case whose predicate does not hold is not taken, and a predicate that evaluates to NaN holds no more than a false one does.Piecewise.InnerSimplifyskipped a false case and kept a NaN one, which then made the whole NaN. It skips both now, in the pass that decides the piecewise outright and in the one that keeps the undecided cases, and the cases after one are read as they would be.Where it showed. An antiderivative written with an arm for each sign of a quantity that is not real -- the integrator writes
piecewise(F provided not q in RR or q > 0, G provided q < 0)-- differentiates arm by arm, and the derivative of the arm forq < 0came back as3x^2 provided -13/10 i - 3/5 < 0. With an arm before it whose predicate still holdsx,not x = 0, the piecewise was left undecided, simplified, and became NaN: the derivative of an answer that is right had no value at any point. Pinned first and then differentiated, it was NaN as well.Tests:
UndefinedPiecewiseConditionTest, four facts, each checking a value rather than a printed form: the undefined case is skipped and the rest kept; an undefined case before a decided one is passed over; with no case that holds it is still NaN; and the derivative of such a piecewise is that of the case that holds.The full suite on
f84c9459passed, 14,890 tests, but forIntegralAnswerCacheTest.AnIntegralWithNoAnswerStillFinishesQuickly, which allows a declined integral thirty seconds and took fifty-seven with four corpus runs on the machine; alone, that class passes in four seconds. The library builds fornetstandard2.0.The head here,
71fd770b, merges master763f7baeinto that; its checks are this pull request's.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura