-
-
Notifications
You must be signed in to change notification settings - Fork 660
Description
Purpose
Introduce a framework for testing whether or not something is a morphism in a category. See the discussion on sage-algebra. Here is a summary of the discussion.
Methods for categories
Categories C
should have a method C.has_morphism(f)
answering whether f
is a morphism in C
. By symmetry, we want a method C.has_object(X)
, answering whether X
is an object in C
.
Note that we want X in C
to be true if and only if X
is an object of C
(so, it is synonymous to C.has_object(X)
). This currently is not always the case:
sage: P.<x,y> = QQ[]
sage: f = P.hom(reversed(P.gens()))
sage: f in Rings().hom_category()
True
but of course f
is not an object of the hom-category (it is only contained in an object of the hom-category).
Class/Set of objects and morphisms
It would be nice to have container classes for the objects and for the morphisms of a category. Then, f in C.morphisms()
would be a very natural notation for C.has_morphism(f)
, and X in C.objects()
would be another way of saying X in C
.
Of course, since f in C.morphisms()
and f in C.objects()
are nice notations, they should be as fast as possible -- otherwise, people wouldn't use them.
Further discussion should be put in comments to this ticket.
Depends on #9138
Depends on #11115
Depends on #11780
Component: categories
Keywords: objects morphisms containment sd34
Work Issues: Cope with non-unique number fields
Author: Simon King
Issue created by migration from https://trac.sagemath.org/ticket/10667