Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty intervals do not properly compare #1

Closed
AlexandreDecan opened this issue Apr 24, 2018 · 1 comment
Closed

Empty intervals do not properly compare #1

AlexandreDecan opened this issue Apr 24, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AlexandreDecan
Copy link
Owner

Empty intervals do not properly compare because of the lower and upper bounds I.inf:

>>> I.empty() in I.open(-I.inf, I.inf)
True
>>> I.empty() in I.closed(0, 1)
False

Even worse, if AtomicInterval instances are directly created with an empty interval, containment depends on the values, not on the "emptiness" of the interval:

>>> i = I.AtomicInterval(False, 0, 0, False)
>>> i in I.closed(-3, -2)
False
>>> i in I.closed(-3, 3)
True

Similar issue holds when intervals are compared:

>>> i < I.singleton(0)
True
>>> i < I.singleton(-1)
False

Empty intervals should always be considered as included in other intervals, and should always compare to true when compared to other intervals.

@AlexandreDecan AlexandreDecan added the bug Something isn't working label Apr 24, 2018
@AlexandreDecan AlexandreDecan self-assigned this Apr 24, 2018
@AlexandreDecan
Copy link
Owner Author

I'll work on this tomorrow.

  • One should be allowed to create intervals with "reversed bounds" (ie. lower is greater than upper). Currently, this is prevented for no specific reason given that such intervals can be considered as a way to represent empty intervals.
  • If we allow "reversed bounds", then we could represent empty intervals as (I.inf, -I.inf). This way, all operations involving an empty interval will be consistent (because everything is greater than -I.inf and lower than I.inf, meaning that empty intervals will be considered as contained in any other ones, as greater/lower than any other ones, and as having no overlap with any other ones).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant