A union with an empty interval is the other set - #1636
Merged
Merged
Conversation
Two intervals were joined wherever one ended where the other began, before
either was asked whether it was empty: [0; 1] \/ [1; 0] became { 1 },
[3; 1] \/ [1; 2] the empty [3; 2], and [a; b] \/ [b; a] became { b }. An
empty interval now adds nothing, and two intervals with ends that are not
numbers are joined only where neither can be empty -- an end at an
infinity, or a single point closed at both ends -- so [a; b] \/ [b; c] is
left as written. A closed point's union was computed and discarded; it is
returned now.
Closes #1634.
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.
UniteIntervalAndIntervaljoined two intervals wherever one ended where the other began, before it asked whether either was empty.[1; 0]is empty, and it ends at 0, where[0; 1]begins, so[0; 1] \/ [1; 0]was joined into{ 1 }. The peer session found this on #1633, where a union was the obvious way to write the segment between an integral's limits.The function now asks about emptiness first:
(-oo; x] \/ [x; +oo)is stillRR, and[a; b] \/ [b; c], where either may be empty, is left as written.Simplifyof[0; 1] \/ [1; 0]{ 1 }— wrong[0; 1][3; 1] \/ [1; 2][3; 2], which is empty — wrong[1; 2][a; b] \/ [b; a]{ b }— wrong[a; b] \/ [b; c][a; c]— wrong wherea > borb > c(-oo; x] \/ [x; +oo)RRRRAnEmptyIntervalAddsNothingTestdecides each union by membership, at points on both sides of every end, rather than reading its printed shape. It also pins the symbolic cases.Suite on net10.0, at
1c52ec44on masterfac6ce16: 14196 passed, none failed. The head,2c74c073, differs from it only in its commit message. Every target framework builds.Gate: allocation matches the baseline on all 19 gated benchmarks.
Closes #1634.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura