#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: Implement
Branch: | backtracking properly
u/SimonKing/ticket/15303 | Commit:
Dependencies: #14711 | 74821fe5409c3104b5d6eb7407a8287d54170df9
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:55 SimonKing]:
> Good(?) news: I can track down the error to the following ''in vanilla
Sage''.
> {{{
> sage: L.<i> = NumberField(x^2 + 1)
> sage: K = NumberField(L(i/2+3).minpoly(), names=('i0',),
embedding=L(i/2+3))
> sage: from sage.rings.number_field import number_field_morphisms
> sage: number_field_morphisms.EmbeddedNumberFieldMorphism(R, self)
> Traceback (most recent call last):
> ...
> RuntimeError: maximum recursion depth exceeded in __instancecheck__
> }}}
>
> The point is that the ''with my patch'', the above code is executed
during construction of K, in order to internally construct something. I'll
ask on sage-nt whether this code ''should'' give a map. I guess it should
not, but perhaps the number theorists disagree. And if it should not give
a map, then there should be a `TypeError` (or `ValueError`) raised,
without infinite recursion.
I suppose you mean
{{{
sage: number_field_morphisms.EmbeddedNumberFieldMorphism(K,L)
}}}
According to the documentation it shouldn't because by default it tries to
see if K and L are both naturally embedded in CC, and they are not.
The following already does work:
{{{
sage: number_field_morphisms.EmbeddedNumberFieldMorphism(K,L,L) #any
combination of K and L
Generic morphism:
From: Number Field in i0 with defining polynomial x^2 - 6*x + 37/4
To: Number Field in i with defining polynomial x^2 + 1
Defn: i0 -> 1/2*i + 3
sage: number_field_morphisms.EmbeddedNumberFieldMorphism(L,L)
Generic endomorphism of Number Field in i with defining polynomial x^2 + 1
Defn: i -> i
}}}
The latter suggests that the routine does take some liberties. For K we
get
{{{
sage: number_field_morphisms.EmbeddedNumberFieldMorphism(K,K)
RuntimeError: maximum recursion depth exceeded while calling a Python
object
}}}
so the difference in behaviour between L and K seems dodgy.
--
Ticket URL: <http://trac.sagemath.org/ticket/15303#comment:60>
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.