#11239: Incorrect coercion of polynomials over finite fields
-------------------------------------+-------------------------------------
Reporter: johanbosman | Owner: robertwb
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.1
Component: coercion | Resolution:
Keywords: finite fields, | Merged in:
polynomials, coercion, sd53 | Reviewers: Jean-Pierre Flori
Authors: Peter Bruin | Work issues:
Report Upstream: N/A | Commit:
Branch: | 236effb6198c6192dce0cedc0e53423c68743e3e
u/jpflori/ticket/11239 | Stopgaps:
Dependencies: #8335 |
-------------------------------------+-------------------------------------
Comment (by pbruin):
Replying to [comment:25 SimonKing]:
> See my answer on sage-devel. In a nutshell: I would recommend against
doing expensive tests when talking about conversion, and I would be rather
permissive in conversions.
>
> Conversions have no defined properties, and thus there is nothing that
one could test.
Given that a conversion needs to coincide with the coercion if the latter
exists, one must check for a coercion before applying the "stupid"
conversion (assuming the "stupid" conversion is desired at all).
In the situation of this ticket, there is a coercion map between the
polynomial rings (assuming the finite fields know that they are
compatible; see the doctests, not the ticket description). The problem
was that the element constructor didn't check for this and always applied
the "stupid" conversion. (The same problem arises when using
`R.coerce(f)`, because the coercion map just defers to a conversion using
the element constructor.)
I think the point in the above discussion was whether my solution of
calling `has_coerce_map_from()` is expensive; I guess not, but even if it
is, it is still necessary to guarantee compatibility of conversion and
coercion.
> They don't need to be composable. They aren't even maps (only partially
defined). It is perfectly fine to have a conversion for all elements of a
ring R1 into a ring R2 and of all elements of a ring R2 into a ring R3,
but only some elements (e.g.: polynomials of degree zero) of R1 convert
into R3 without raising an error.
That is actually what I was trying to say on sage-devel in the context of
polynomial ring quotients, but I wasn't very clear. I agree that the
existence of coercion doesn't have to be transitive, or to satisfy any
rules; in the context of this ticket, I think it is perfectly fine if the
"stupid" conversion is not used at all.
--
Ticket URL: <http://trac.sagemath.org/ticket/11239#comment:26>
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.