#12969: Coercion failures in symmetric functions
-------------------------------------------------+--------------------------
       Reporter:  aschilling                     |         Owner:  sage-combinat
           Type:  defect                         |        Status:  needs_review 
       Priority:  major                          |     Milestone:  sage-5.3     
      Component:  combinatorics                  |    Resolution:               
       Keywords:  symmetric functions, coercion  |   Work issues:               
Report Upstream:  N/A                            |     Reviewers:               
        Authors:  Simon King                     |     Merged in:               
   Dependencies:                                 |      Stopgaps:               
-------------------------------------------------+--------------------------

Comment (by SimonKing):

 The patch seems to work. But meanwhile I wonder whether my fix is really
 correct.

 The aim is: Find a coercion from X to Y.

 Backtracking means: We know some B1,B2,... that coerce into Y. Hence, we
 try to find a coercion from X to B1,B2,... but avoiding Y, so that there
 is no infinite loop. That's why the pair (X,Y) is temporarily disregarded
 when searching for a coerce path.

 In particular, the recursive search will always start at X.

 Hence, it was my understanding that all temporarily disregarded paths
 start at X. That's why I wrote
 {{{
 #!python
 cdef bint _may_cache_none(x, y, tag) except -1:
     # Are we allowed to cache the absence of a coercion
     # from y to x? We are only allowed, if y is *not*
     # part of any coerce path that is temporarily disregarded,
     # with the only exception of the path from y to x.
     # See #12969.
     cdef EltPair P
     for P in _coerce_test_dict.iterkeys():
         if (P.y is y) and (P.x is not x) and (P.tag is tag):
             return 0
     return 1
 }}}

 However, to be on the safe side, I tested whether I drew the correct
 conclusion. Apparently I didn't.

 Namely, when Sage starts and a coercion from the complex double field
 into, say, the integer ring is sought, then the path from the complex lazy
 field to the complex double field is disregarded. Also, while trying to
 find a coercion from the complex lazy field to the integers, the search
 path from "Number Field in I with defining polynomial x^2^ + 1" to the
 rational field is temporarily disregarded.

 Even weirder: When doing `m(P.one())` in the example from the ticket
 description, the coercion from "<type 'str'>" to Fraction Field of
 Multivariate Polynomial Ring in q, t over Rational Field is disregarded,
 while searching for a coerce path from None (sic!) to the ring of
 integers.

 I wonder how this can possibly happen, given how backtracking works. And
 what does that mean for the patch? I guess the cleanest solution would be
 to find out why the wrong paths are temporarily disregarded, and why the
 heck a coercion from None to anything is requested.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12969#comment:31>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to