-
-
Notifications
You must be signed in to change notification settings - Fork 660
Open
Description
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 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.
Depends on #14711
Depends on #15329
Depends on #15331
CC: @simon-king-jena @robertwb @jpflori
Component: coercion
Work Issues: rebase (11 files conflicting)
Author: Simon King
Branch/Commit: u/SimonKing/ticket/15303 @ 12e8055
Issue created by migration from https://trac.sagemath.org/ticket/15303