#10668: Refactor category support for morphisms (Hom is not a functorial
construction!)
------------------------------+-----------------------
       Reporter:  nthiery     |        Owner:  nthiery
           Type:  defect      |       Status:  new
       Priority:  major       |    Milestone:
      Component:  categories  |   Resolution:
       Keywords:              |    Merged in:
        Authors:              |    Reviewers:
Report Upstream:  N/A         |  Work issues:
         Branch:              |       Commit:
   Dependencies:              |     Stopgaps:
------------------------------+-----------------------
Description changed by nthiery:

Old description:

> Hom is currently implemented as a covariant functorial
> construction:
>
> {{{
>     sage: Rings().hom_category()
>     Category of hom sets in Category of rings
>     sage: Rings().hom_category().super_categories()
>     [Category of hom sets in Category of sets]
> }}}
>
> The intention was to model the fact that a morphism in a category is
> also a morphism in any super category, via the forgetful functor. With
> the example above, if A and B are rings, then a ring morphism phi:
> A->B is also a set morphism. However, at the level of parents, and as
> noted in the documentation of sage.category.HomCategory, this is
> mathematically plain wrong: if A and B are rings, then Hom(A,B) in the
> category of rings does not coincide with Hom(A,B) in the category of
> sets.
>
> I, Nicolas, take full blame for this misfeature; it was just the
> shortest route to implement some urgently needed features about
> morphisms, and still get that huge chunk of category code done.
>
> Here are some thoughts for a proper implementation:
>
>  - Add support for a MorphismsMethods subclass, similar to
>    ElementMethods and ParentMethods. If Cat is a category, then
>    Cat.MorphismMethods will provide generic methods for morphisms in
>    Cat and in any subcategory. This can be achieved by:
>
>     - Building of a hierarchy of abstract classes Cat.morphism_class,
>       similar to Cat.element_class and Cat.parent_class (10 lines of
>       code; see Category.element_class).
>
>     - Having morphisms in Cat inherit from Cat.morphism_class. This
>       can be achieved by overiding either:
>
>        - Parent.element_class in Homset.element_class
>        - Category.element_class in HomCategory.element_class (my
> preferred choice at this point)
>
>  - Fix HomCategory. For Cat a category, the purpose of
>    Cat.hom_category() shall be to provide mathematical information
>    about its homsets (e.g. that a homset in the category of vector
>    spaces is also a vector space). It should ignore the super
>    categories of C in general, except if is a full subcategory (a
>    homset in the category of finite groups is also a homset in the
>    category of groups).
>
>  - If CatA is a subcategory of CatB, add automatic coercion (or just
>    conversion?) from Hom(A,B, CatA) to Hom(A, B, CatB), modeling the
>    appropriate forgetful functor. There are too many such coercions
>    for them to be registered explicitly. So this probably need to be
>    implemented through a specific CatB._has_coerce_map_from(A) for
>    homsets.
>
>  - Extend/use sage.categories.pushout to handle mixed morphism
>    arithmetic (e.g. having the sum of an algebra morphism and a
>    coalgebra morphism return a vector space morphism).

New description:

 Hom is currently implemented as a covariant functorial
 construction:

 {{{
     sage: Rings().hom_category()
     Category of hom sets in Category of rings
     sage: Rings().hom_category().super_categories()
     [Category of hom sets in Category of sets]
 }}}

 The intention was to model the fact that a morphism in a category is
 also a morphism in any super category, via the forgetful functor. With
 the example above, if A and B are rings, then a ring morphism phi:
 A->B is also a set morphism. However, at the level of parents, and as
 noted in the documentation of sage.category.HomCategory, this is
 mathematically plain wrong: if A and B are rings, then Hom(A,B) in the
 category of rings does not coincide with Hom(A,B) in the category of
 sets.

 I, Nicolas, take full blame for this misfeature; it was just the
 shortest route to implement some urgently needed features about
 morphisms, and still get that huge chunk of category code done.

 Here are some thoughts for a proper implementation:

  - Add support for a MorphismsMethods subclass, similar to
    ElementMethods and ParentMethods. If Cat is a category, then
    Cat.MorphismMethods will provide generic methods for morphisms in
    Cat and in any subcategory. This can be achieved by:

     - Building of a hierarchy of abstract classes Cat.morphism_class,
       similar to Cat.element_class and Cat.parent_class (10 lines of
       code; see Category.element_class).

     - Having morphisms in Cat inherit from Cat.morphism_class. This
       can be achieved by overiding either:

        - Parent.element_class in Homset.element_class
        - Category.element_class in HomCategory.element_class (my preferred
 choice at this point)

  - Fix HomCategory. For Cat a category, the purpose of
    Cat.hom_category() shall be to provide mathematical information
    about its homsets (e.g. that a homset in the category of vector
    spaces is also a vector space). It should ignore the super
    categories of C in general, except if is a full subcategory (a
    homset in the category of finite groups is also a homset in the
    category of groups).

  - If CatA is a subcategory of CatB, add automatic coercion (or just
    conversion?) from Hom(A,B, CatA) to Hom(A, B, CatB), modeling the
    appropriate forgetful functor. There are too many such coercions
    for them to be registered explicitly. So this probably need to be
    implemented through a specific CatB._has_coerce_map_from(A) for
    homsets.

  - Extend/use sage.categories.pushout to handle mixed morphism
    arithmetic (e.g. having the sum of an algebra morphism and a
    coalgebra morphism return a vector space morphism).

  - Remove HomCategory from the global namespace

  - Possibly: rename both HomCategory and hom_category to Homsets.
    This would be consistent with CartesianProducts, ...

--

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