#15303: Coercion discovery fails to be transitive
------------------------+-----------------------------
Reporter: nbruin | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: coercion | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
------------------------+-----------------------------
As found in #14711:comment:134, the following example shows that a
combination of `register_embedding` and `register_coercion` can lead to a
failure in transitivity for coercion discovery; also discussed on
[https://groups.google.com/forum/?hl=en#!topic/sage-devel/pH-97DE41wA
sage-devel]:
{{{
class pA(Parent): pass
class pB(Parent): pass
class pC(Parent): pass
A=pA(); B=pB(); C=pC()
BtoA=Hom(B,A)(lambda x: A(x))
AtoC=Hom(A,C)(lambda x: C(x))
A.register_coercion(BtoA)
A.register_embedding(AtoC)
G=get_coercion_model()
G.discover_coercion(A,C) #finds AtoC
G.discover_coercion(B,A) #finds BtoA
G.discover_coercion(B,C) #does not find the composition of BtoA with AtoC
}}}
One workaround is simple: just don't use `register_embedding`. However,
after #14711, there are different lifetime implications between using
`register_embedding` and `register_coercion`, so this workaround might not
be desirable.
--
Ticket URL: <http://trac.sagemath.org/ticket/15303>
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.