Repository navigation
A set-builder whose predicate is NaN is empty, and a set is never a constant in the derivative - #1455
Merged
Merged
Conversation
…onstant in the derivative Two findings of the workspace harnesses against 04a5dd4, both from work merged today: - crashcheck: `"x subset 2".ToEntity().Solve("x")` threw InvalidCastException. The solver answers `{ x : x subset 2 }`; the predicate is NaN, since 2 is not a set, and a NaN predicate made the whole set-builder NaN, which Solve then cast to a set. A predicate that is NaN holds nowhere, so the set-builder is the empty set -- which is what the solver already answered for `1/0 = x`, and what `{ x : 1/0 = x }` now evaluates to as well (was NaN in 2.5.0; recorded). - docsamples: `"{ 1, 2 } + sin(x)".Differentiate("x")` printed `cos(x)` where the wiki's Differentiation page says `{ cos(x) }`. #1451 made the base derivative of a node that does not mention the variable zero; a set is not a constant in the variable whatever it mentions, so a set keeps the derivative node, which reaches the elements. Part of #1409. Co-Authored-By: Claude Opus 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.
Two findings of the workspace harnesses run against
04a5dd45(today's master), both from work merged today.crashcheck —
"x subset 2".ToEntity().Solve("x")threwInvalidCastException: Unable to cast object of type 'Real' to type 'Set'atEntity.Solve. The statement solver answers{ x : x subset 2 }; the predicate isNaNsince2is not a set, and aNaNpredicate made the whole set-builderNaN, whichSolvethen cast to aSet. A predicate that isNaNholds nowhere, so the set-builder is now the empty set — which is what the solver already answered for1/0 = x— and{ x : 1/0 = x }evaluates to{ }too, where 2.5.0 saidNaN(recorded inBREAKING-CHANGES.md;subsetitself is unreleased).docsamples —
"{ 1, 2 } + sin(x)".Differentiate("x")printedcos(x)where the wiki's Differentiation page says{ cos(x) }. #1451 made the base derivative of a node with no rule of its own that does not mention the variable0; a set is not a constant in the variable whatever it mentions —{ 1, 2 } + sin(x)is{ 1 + sin(x), 2 + sin(x) }— so a set keeps the derivative node, which reaches the elements.[1, 2] * xdifferentiates to[1, 2]unchanged (matrices have their own rule).Tests:
SubsetTest.APredicateThatIsNaNHoldsNowhere(both spellings,SolveandEvaled),ModulusPhaseTest.ASetDifferentiatesElementwiseNotToZero. Full suite 12515 passed, 0 failed; the kernel gate PASSED on all 19 gated benchmarks against the84f83fd7baseline.Part of #1409.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura