#14793: Unique representation for homsets
-------------------------------+--------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.12
Component: categories | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
-------------------------------+--------------------------------------------
Comment (by SimonKing):
Here is the problem and a potential solution.
While unpickling of the modular symbols M, we need to construct a homset
with domain and codomain M. At this point, calling M.category() results in
an error, since M.base() returns None and M.category() wants to return
Modules(M.base()).
Hence, in the code of the Hom function from sage.categories.homset, the
lines
{{{
#!python
cat_X = X.category()
cat_Y = Y.category()
}}}
crash.
The point is: When Hom is called in the process of unpickling a homset,
then the correct category is supplied. Hence, the argument "category" of
Hom is not None. And I think if in this situation `X.category()` raises an
error then we can simply ignore the error and skip the consistency check
`cat_X.is_subcategory(category)`.
Hence, I'd do:
{{{
if category is None:
category = X.category()._meet_(Y.category())
# Recurse to make sure that Hom(X, Y) and Hom(X, Y, category) are
identical
H = Hom(X, Y, category)
else:
# while unpickling, it is possible that the
# categories of X and Y are not initialised
# and a default category can't be determined.
# Since cat_X/Y.is_subcategory(category) is just
# a sanity check anyway, we will ignore an error
# that is raised when determining cat_X/cat_Y
if not isinstance(category, Category):
raise TypeError, "Argument category (= %s) must be a
category."%category
try:
cat_X = X.category()
except BaseException:
cat_X = category
try:
cat_Y = Y.category()
except BaseException:
cat_Y = category
if not cat_X.is_subcategory(category):
raise TypeError, "%s is not in %s"%(X, category)
if not cat_Y.is_subcategory(category):
raise TypeError, "%s is not in %s"%(Y, category)
# Construct H
try: # _Hom_ hook from the parent
H = X._Hom_(Y, category)
...
}}}
Do you think this is a feasible idea?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14793#comment:12>
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/groups/opt_out.