#10667: Morphisms and Objects of Categories
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: categories | Keywords: objects morphisms containment
Work_issues: doctests | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9138, #11115
---------------------------+------------------------------------------------
Comment(by SimonKing):
Currently, I'm having trouble with getting an appropriate class for the
homsets.
You know that rings have a specially designed class for their homsets:
{{{
sage: Rings().HomCategory
<class 'sage.categories.rings.Rings.HomCategory'>
sage: Rings().HomCategory(Rings()).parent_class.__module__
'sage.categories.rings'
}}}
By #9944 and #9138, polynomial rings are (commutative) algebras and not
just rings. The category of algebras does not define their own
`HomCategory` class.
However, two of its super categories have special `HomCategory`, namely
{{{
sage: Modules(ZZ).HomCategory
<class 'sage.categories.modules.Modules.HomCategory'>
sage: Rings().HomCategory
<class 'sage.categories.rings.Rings.HomCategory'>
}}}
Wouldn't it be a good idea to create a lazy attribute `HomCategory` for
`sage.categories.category.Category`, that returns a dynamic class formed
by all the hom category classes of the super categories?
Hence, what I suggest means that `Algebras(ZZ).HomCategory` would be a
sub-class of both `Rings().HomCategory` and `Modules(ZZ).HomCategory`. At
least in this example, it would work, regardless of the order:
{{{
sage: class Foo(Rings().HomCategory, Modules(ZZ).HomCategory): pass
....:
sage: class Foo(Modules(ZZ).HomCategory, Rings().HomCategory): pass
....:
}}}
As a dynamic class, we would probably have
{{{
sage: from sage.structure.dynamic_class import dynamic_class
sage: from sage.categories.category import HomCategory
sage: dynamic_class('FooHomCategory', (Rings().HomCategory,
Modules(ZZ).HomCategory, HomCategory))
<class 'sage.categories.rings.FooHomCategory'>
}}}
But note that putting `HomCategory` in front of the tuple or providing it
as second argument after the tuple will ''not'' work.
I think that this would be a very clean solution. The method resolution
order of the dynamic class would, if I understand correctly, first pick up
the stuff defined for rings, then the stuff defined for modules, and
finally the generic stuff of `HomCategory`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10667#comment:28>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.