#10513: Coercion and category framework for modules
-------------------------------------+-------------------------------------
Reporter: SimonKing | Owner: robertwb
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: coercion | Resolution:
Keywords: coercion, | Merged in:
category framework, modules | Reviewers:
Authors: Simon King, Peter | Work issues:
Bruin | Commit:
Report Upstream: N/A | 5126b66a6c5ba2d52b6daff6ee489aa8b48a7548
Branch: | Stopgaps:
u/pbruin/10513-coercion_and_categories_for_modules|
Dependencies: #16507 |
-------------------------------------+-------------------------------------
Description changed by pbruin:
Old description:
> Currently, modules in Sage do not use the category framework and are
> based on the old coercion model. Moreover, some coercions go wrong:
>
> Without my patch, we have
> {{{
> sage: V3 = QQ^3
> sage: M = V3 / [[1,2,3]]
> sage: V2 = QQ^2
> sage: N = V3 / [[1,1,1]]
> # The quotient maps are of course coercions
> sage: f3M = M.coerce_map_from(V3)
> sage: f3N = N.coerce_map_from(V3)
> # The following is a bug...
> sage: V2.has_coerce_map_from(N)
> True
> sage: M.has_coerce_map_from(V2)
> True
> sage: N.has_coerce_map_from(V2)
> True
> #... because the composition of coercion
> # from N to V2 to M should be a coercion,
> # but it isn't:
> sage: M.has_coerce_map_from(N)
> False
> # Moreover, we obtain a non-commuting triangle of
> # coercions:
> sage: fM2 = V2.coerce_map_from(M)
> sage: fN2 = V2.coerce_map_from(N)
> sage: [fM2(f3M(x)) for x in V3.basis()]
> [(1, 0), (0, 1), (-1/3, -2/3)]
> sage: [fN2(f3N(x)) for x in V3.basis()]
> [(1, 0), (0, 1), (-1, -1)]
> }}}
>
> Comparison goes wrong as well without my patch:
> {{{
> sage: V2==M
> True
> sage: M==V2
> False
> }}}
>
> My patch removes the coercion between abstract module `V^2` and the
> quotient modules. Moreover, we then have `V2!=M`.
>
> I did not implement the "advanced" bits of coercion yet, namely the
> construction functor and pushout magic. This will be dealt with on a
> different ticket.
>
> Note that what I propose here goes beyond what is done "on the fly" in
> #9713, whose main purpose isn't coercion anyway. Moreover, my patch here
> does hardly touch the stuff that is really important for #9713. Hence, I
> suggest to add the ticket here to the long list of dependencies for
> #9713.
New description:
Currently, modules in Sage are based on the old coercion model and do not
cooperate well with the category framework. This ticket updates almost
all module classes to the use new coercion model and the category
framework.
Moreover, some coercions go wrong:
{{{
sage: V3 = QQ^3
sage: M = V3 / [[1,2,3]]
sage: V2 = QQ^2
sage: N = V3 / [[1,1,1]]
# The quotient maps are of course coercions
sage: f3M = M.coerce_map_from(V3)
sage: f3N = N.coerce_map_from(V3)
# The following is a bug...
sage: V2.has_coerce_map_from(N)
True
sage: M.has_coerce_map_from(V2)
True
sage: N.has_coerce_map_from(V2)
True
#... because the composition of coercion
# from N to V2 to M should be a coercion,
# but it isn't:
sage: M.has_coerce_map_from(N)
False
# Moreover, we obtain a non-commuting triangle of
# coercions:
sage: fM2 = V2.coerce_map_from(M)
sage: fN2 = V2.coerce_map_from(N)
sage: [fM2(f3M(x)) for x in V3.basis()]
[(1, 0), (0, 1), (-1/3, -2/3)]
sage: [fN2(f3N(x)) for x in V3.basis()]
[(1, 0), (0, 1), (-1, -1)]
}}}
Comparison goes wrong as well:
{{{
sage: V2==M
True
sage: M==V2
False
}}}
In the above examples, this ticket removes the coercion between abstract
module `V^2` and the quotient modules, and makes sure that `V2!=M`.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/10513#comment:14>
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.