#15618: Use the correct categories for coercion and conversion maps
-------------------------------------+-------------------------------------
Reporter: pbruin | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-6.3
Component: coercion | Resolution:
Keywords: conversion map | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues: add doctests
Branch: | Commit:
u/pbruin/15618-DefaultConvertMap | d261a37914aec9a0b7949fd526881003d3214f62
Dependencies: #16401, #16402 | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by {'newvalue': u'Peter Bruin', 'oldvalue': ''}):
* work_issues: => add doctests
* author: => Peter Bruin
Old description:
> The following examples show that some convert_maps are incorrectly
> assumed to be homomorphisms:
> {{{
> sage: f = ZZ.convert_map_from(QQ)
> sage: f.parent()
> Set of Homomorphisms from Rational Field to Integer Ring
> }}}
> {{{
> sage: f = ZZ.convert_map_from(GF(2))
> sage: f.parent()
> Set of field embeddings from Finite Field of size 2 to Integer Ring
> }}}
> {{{
> sage: f = GF(11).convert_map_from(GF(7))
> sage: f
> Conversion map:
> From: Finite Field of size 7
> To: Finite Field of size 11
> sage: f.parent()
> Set of field embeddings from Finite Field of size 7 to Finite Field of
> size 11
> }}}
> This has the effect of constructing an element of a set that is in fact
> empty.
>
> Moreover, conversions should in general only be assumed to be partial
> maps, because they are not necessarily defined everywhere.
>
> See also https://groups.google.com/forum/#!topic/sage-devel/Z4iNgVMFoms
New description:
The following examples show that some convert_maps are incorrectly assumed
to be homomorphisms:
{{{
sage: f = ZZ.convert_map_from(QQ)
sage: f.parent()
Set of Homomorphisms from Rational Field to Integer Ring
}}}
{{{
sage: f = ZZ.convert_map_from(GF(2))
sage: f.parent()
Set of field embeddings from Finite Field of size 2 to Integer Ring
}}}
{{{
sage: f = GF(11).convert_map_from(GF(7))
sage: f
Conversion map:
From: Finite Field of size 7
To: Finite Field of size 11
sage: f.parent()
Set of field embeddings from Finite Field of size 7 to Finite Field of
size 11
}}}
This has the effect of constructing an element of a set that is in fact
empty.
Moreover, conversions should in general only be assumed to be partial
maps, because they are not necessarily defined everywhere.
This ticket fixes the problem in two steps:
- use `SetsWithPartialMaps` as the category for `DefaultConvertMap`;
- make internal ("reference-weakened") coercion and conversion maps
remember their category (the fact that this didn't work is only revealed
by the above change).
See also https://groups.google.com/forum/#!topic/sage-devel/Z4iNgVMFoms
--
Comment:
The new commit solves the unpickling problem, all tests now pass. (The
pickles weren't necessarily broken, my patch was trying to access the
category of partially-unpickled homsets.)
--
Ticket URL: <http://trac.sagemath.org/ticket/15618#comment:13>
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/d/optout.