#16676: Cardinality of infinite sets loops forever
--------------------------------------+------------------------
       Reporter:  defeo               |        Owner:
           Type:  defect              |       Status:  new
       Priority:  major               |    Milestone:  sage-6.3
      Component:  combinatorics       |   Resolution:
       Keywords:  sets infinite_loop  |    Merged in:
        Authors:                      |    Reviewers:
Report Upstream:  N/A                 |  Work issues:
         Branch:                      |       Commit:
   Dependencies:                      |     Stopgaps:
--------------------------------------+------------------------

Comment (by defeo):

 Looping forever is always a bug in my opinion. The class
 `Set_object_difference` knows in advance that the loop is not going to
 stop when the first set is infinite, thus it could avoid the computation.
 This only solves the first layer of the problem, though.

 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
 `is_finite(try_hard=True)`, then `Set_object_difference` could be smart
 and run it only when `self.__X.is_finite(try_hard=True)` returns true.

 However this would require a thorough redesign of the `Set` API, which I
 do not have time to start right now. I was merely reporting the bug for
 reference.

 By the way, the fix you suggest would clash on the following bug of
 `is_finite()`:

 {{{
 sage: Set(ZZ).difference(Set()).is_finite()
 ...
 RuntimeError: maximum recursion depth exceeded while calling a Python
 object
 }}}

 This is a different problem and an easy fix, though, as long as we agree
 that `False` means "I don't know".

--
Ticket URL: <http://trac.sagemath.org/ticket/16676#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to