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
Cardinality of infinite sets loops forever #16676
Comments
comment:1
Hi, This is not a bug. Deciding if an iterator is finite is semi-decidable and I do not want that because only half of the answer is known we do not give it a try. There are many problems which are known to be undecidable (like equality of symblolic stuff, or the word problem in fg groups). But it is worth it to design the best algorithm that answer most of the cases. One way to "fix" this non-problem would be to through a warning before we start the enumeration:
Vincent |
comment:2
Looping forever is always a bug in my opinion. The class Obviously the problem is undecidable. A properly designed system should only start the enumeration when it knows the set is finite. This is best implemented with three-way logic, a topic that resurfaces often in discussion threads. The semi-decidable algorithm could still be run by a call to However this would require a thorough redesign of the By the way, the fix you suggest would clash on the following bug of
This is a different problem and an easy fix, though, as long as we agree that |
comment:3
I do not agree. |
comment:4
Replying to @videlec:
Me neither. So I guess someone must step up and add three-way logic to the Set API. A grep for |
comment:5
Sage (for now) says |
comment:7
Hello, Actually, it is "solved" in #18159 as
... (needs review) ... |
comment:9
Now #18159 is closed and we will have
I suggest to close this ticket as won't fix. Or do you think it is worth to add a doctest for these? Vincent |
comment:10
I do not think a doctest is needed. I'll compile #18159 as soon as I have a little spare time, and close this ticket if everything looks ok. |
comment:11
Perhaps we should start adding parentheses in those error messages. Something like
But then we would eventually end up with the more lisp-looking message
Sigh... Nathann |
This was reported in Ask question http://ask.sagemath.org/question/23467.
Most operations on Sets have their
cardinality()
method defined byThis obviously fails on infinite sets which Sage does not know of:
Component: combinatorics
Keywords: sets infinite_loop
Issue created by migration from https://trac.sagemath.org/ticket/16676
The text was updated successfully, but these errors were encountered: