#15303: Coercion discovery fails to be transitive
-------------------------------------+-------------------------------------
       Reporter:  nbruin             |        Owner:
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-5.13
      Component:  coercion           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Simon King         |    Reviewers:
Report Upstream:  N/A                |  Work issues:  analyse recursion
         Branch:                     |  error
  u/SimonKing/ticket/15303           |       Commit:
   Dependencies:  #14711             |  f837cbee8f81c4946a92193c73e86449c53515d9
                                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 It seems to me that the `._coerce_costs` of a map are largely ignored.
 Namely, in `.discover_coercion()`, we have a parameter `num_paths`: If
 `num_paths` paths in the coercion graph are found by backtracking, then
 the path with the least `._coerce_costs` is returned. But since
 `num_paths=1`, in fact ''the first'' found coercion is returned.

 The only exception is the user provided morphism. Here, the rule is: Even
 if the user provides a coerce morphism, then one still searches a coercion
 by backtracking, and in case of success the coerce costs of the user-
 provided morphism is compared with the other morphism.

 This just isn't fair!!! I believe that the user-provided morphism should
 at least have the same priority as a morphism found by backtracking.

 Two approaches, that are not mutually exclusive:
 1. Amend the coerce costs, so that a simple map has less costs than a
 composite map, unless there is a very good reason.
 2. Let the user-provided morphism count for the number of morphisms found
 in `.discover_coercion()`. Hence, if `num_paths=1` and the user provides a
 morphism, then the maximal number of paths-to-be-considered is attained
 and hence the user-provided morphism is returned without backtracking.

 I think the second point is more important, and I will implement it now.

--
Ticket URL: <http://trac.sagemath.org/ticket/15303#comment:27>
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/groups/opt_out.

Reply via email to