#15618: Use the correct categories for coercion and conversion maps
-------------------------------------+-------------------------------------
       Reporter:  pbruin             |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.3
      Component:  coercion           |   Resolution:
       Keywords:  conversion map     |    Merged in:
        Authors:  Peter Bruin        |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/pbruin/15618-DefaultConvertMap   |  54a6ecae11f902b11ad651c67af021af6ed2da21
   Dependencies:  #16401, #16402     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by pbruin):

 * status:  needs_work => needs_review
 * work_issues:  add doctests =>


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.
>
> 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

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.  A conversion map should in general only be a morphisms in the
 category of sets with partial maps, because it is not necessarily defined
 everywhere.  (In case it ''is'' defined everywhere, it may of course be
 placed in the category of sets.)

 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 was revealed by
 the above change).

 See also https://groups.google.com/forum/#!topic/sage-devel/Z4iNgVMFoms

--

Comment:

 Note to reviewer(s): the branches of the dependencies (#16401, #16402) are
 not merged in this branch.

--
Ticket URL: <http://trac.sagemath.org/ticket/15618#comment:15>
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.

Reply via email to