#11935: Make parent/element classes independent of base rings
----------------------------------------------------------------+-----------
Reporter: SimonKing |
Owner: nthiery
Type: enhancement |
Status: needs_work
Priority: major |
Milestone: sage-4.7.3
Component: categories |
Keywords: parent class, element class, category
Work_issues: Fix doctest in covariant functorial construction |
Upstream: N/A
Reviewer: |
Author: Simon King
Merged: |
Dependencies: #9138 #11900 #11943
----------------------------------------------------------------+-----------
Comment(by SimonKing):
Replying to [comment:16 SimonKing]:
> For some reason, #11935 together with #11943 result in one doctest
error, namely in the "FooBars" test of
`sage/categories/covariant_functorial_construction.py`. So, it needs work.
Here is the problem:
{{{
sage: from sage.categories.covariant_functorial_construction import
CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
... _functor_category = 'FooBars_function'
...
sage: def FooBars_function(X): return FooBars(X)
...
sage: C = FooBars(ModulesWithBasis(QQ))
sage: import __main__; __main__.FooBars_function = FooBars_function
sage: __main__.FooBars = FooBars
sage: Category.FooBars_function = FooBars_function
}}}
Now, requesting `C.parent_class` results in a complaint regarding
"`duplicate base class FooBars.parent_class`". Indeed, with the patch from
here, we have
{{{
sage: CA = FooBars(AdditiveMagmas())
sage: CM = FooBars(Magmas())
sage: CA.parent_class == CM.parent_class
True
}}}
even though we have
{{{
sage: Magmas().parent_class is AdditiveMagmas().parent_class
False
}}}
So, I was overdoing it: With my patch, the parent class not only becomes
independent of a base ring, but also it becomes independent of the base
category of a covariant functorial construction - and this is not what we
want.
The point is that CA and CM above have the same super categories, namely
`FooBars(Sets())`. But with my patch, parent classes are the same if both
the super categories and the `ParentMethods` are the same. The
`ParentMethods` are different for `Magmas()` and `AdditiveMagmas()`, but
they are the same for `FooBars(Magmas())` and `FooBars(AdditiveMagmas())`.
I wonder how this should be solved.
One possibility is that sage.categories.covariant_functorial_constructions
overrides the parent_class and element_class lazy attributes that are
defined in sage.categories.category.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:17>
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.