#15303: Coercion discovery fails to be transitive
----------------------------+-------------------------
       Reporter:  nbruin    |        Owner:
           Type:  defect    |       Status:  new
       Priority:  major     |    Milestone:  sage-5.13
      Component:  coercion  |   Resolution:
       Keywords:            |    Merged in:
        Authors:            |    Reviewers:
Report Upstream:  N/A       |  Work issues:
         Branch:            |       Commit:
   Dependencies:            |     Stopgaps:
----------------------------+-------------------------

Comment (by SimonKing):

 Replying to [comment:5 nbruin]:
 > I don't think you can establish whether something is a non-sink, since
 `_coerce_from_map` gives programmatic answers about that.

 Perhaps I have not been clear. A non-sink non-source is something that has
 both in-arrows (i.e., is codomain of a registered coercion or coerce
 embedding) and out-arrows (i.e., is domain of a registered coercion or
 coerce embedding). It is easy to keep track of this property while
 registering a coercion or coerce embedding.

 But I actually think that your idea is better anyway:

 > A start might be to only version up on "embedding" creations.

 It seems to me that this versioning would be complete under reasonable
 assumptions, based on the following lemma.

 '''Lemma'''

 Assume for all parents `P`, `Q`,  `P.register_coercion(Q)` will be done in
 `P.__init__()`, but not later. Assume that parent `R` to parent `S` exist
 at time `t_0`, but there is no path from `R` to `S` in the coerce digraph
 at time `t_0`. Assume that between time `t_0` and time `t_1`,
 `.register_embedding()` has never been called. Then, there is no path from
 `R` to `S` in the coerce digraph at time `t_1`.

 __Proof__

 Proof be contradiction. We assume that there is a path from `R` to `S` at
 time `t_1`. Hence, this path contains an arrow `a` that has been added to
 the coerce digraph after `t_0`. Since no `register_embedding()` has
 occurred between `t_0` and `t_1`, all arrows created between `t_0` and
 `t_1` have been added by `register_coercion()`. But by hypothesis,
 `register_coercion()` is only called during `__init__` of the codomain.

 Hence, all arrows created between `t_0` and `t_1` end at parents created
 after `t_0`. Therefore, a path in the coerce digraph at time `t_1` that
 contains `a` will necessarily end at a parent that has been created after
 `t_0`. This is a contradiction, since `S` has already existed at time
 `t_0`

 '''q.e.d.'''

 > That might very well be usable. I expect "embeddings" to be relatively
 rare, and I think we can declare in our documentation they are not the
 preferred way of expressing relations (they are vary prone to creating
 non-commutative diamonds).

 We could express in the documentation that one should call
 `register_coercion` only in the initialisation. Since `register_embedding`
 can only be called one time for each parent, I don't think we need to say
 that other methods of establishing a coercion are preferred.

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