#9138: Categories for all rings
--------------------------+-------------------------------------------------
Reporter: jbandlow | Owner: nthiery
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.7.1
Component: categories | Keywords: introspection, categories for
rings
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: sage-4.7, #11268, #11139, #9976,
#9944, #11269
--------------------------+-------------------------------------------------
Changes (by SimonKing):
* status: needs_work => needs_review
* work_issues: Steenrod algebras =>
Old description:
> Introspection is failing on polynomial rings:
> {{{
> sage: R.<x> = QQ[]
> sage: R.su<tab>
> R.sum R.summation
> R.summation_from_element_class_add
> sage: R.sum?
> Object `R.sum` not found.
> sage: R.sum()
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call
> last)
> }}}
>
> This is because polynomial rings do not yet set their category properly:
> {{{
> sage: QQ[x]._test_category()
> ------------------------------------------------------------
> Traceback (most recent call last):
> ...
> AssertionError: category of self improperly initialized
> }}}
>
> See http://groups.google.com/group/sage-
> devel/browse_thread/thread/4780192a11a8b591 for more discussion.
>
> Many other rings are not properly initialised as well. The aim of this
> ticket is to change that.
>
> Depends on #11268, #11139, #9976, #9944, #11269
>
> Apply trac9138-categories_for_rings.patch,
> trac9138_categories_for_more_rings.rebase4.7.1.a1.patch
New description:
Introspection is failing on polynomial rings:
{{{
sage: R.<x> = QQ[]
sage: R.su<tab>
R.sum R.summation
R.summation_from_element_class_add
sage: R.sum?
Object `R.sum` not found.
sage: R.sum()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
}}}
This is because polynomial rings do not yet set their category properly:
{{{
sage: QQ[x]._test_category()
------------------------------------------------------------
Traceback (most recent call last):
...
AssertionError: category of self improperly initialized
}}}
See http://groups.google.com/group/sage-
devel/browse_thread/thread/4780192a11a8b591 for more discussion.
Many other rings are not properly initialised as well. The aim of this
ticket is to change that.
Depends on #11268, #11139, #9976, #9944, #11269
Apply
- [attachment:trac9138-categories_for_rings.patch]
- [attachment:trac9138_categories_for_more_rings.rebase4.7.1.a1.patch]
--
Comment:
The problem was that some doc tests in sage/rings violate the unique
parent assumption on purpose. But homsets will try to be unique even if
domain and codomain are not unique. That's bad.
Therefore, I made the following change for my first patch: If
`Hom(X,Y,category)` is able to find a hom set H for the given data in
cache, then it is first tested that `H.domain() is X` and `H.codomain() is
Y`. If it isn't, then a new hom set is constructed, and put into the
cache.
Hence, we have (as a new doctest):
{{{
By trac ticket #9138, we abandon the uniqueness of hom sets, if the
domain or
codomain break uniqueness::
sage: from sage.rings.polynomial.multi_polynomial_ring import
MPolynomialRing_polydict_domain
sage: P.<x,y,z>=MPolynomialRing_polydict_domain(QQ, 3,
order='degrevlex')
sage: Q.<x,y,z>=MPolynomialRing_polydict_domain(QQ, 3,
order='degrevlex')
sage: P == Q
True
sage: P is Q
False
Hence, P and Q are not unique parents. By consequence, the following
homsets
aren't either::
sage: H1 = Hom(QQ,P)
sage: H2 = Hom(QQ,Q)
sage: H1 == H2
True
sage: H1 is H2
False
It is always the most recently constructed hom set that remains in the
cache::
sage: H2 is Hom(QQ,Q)
True
}}}
The second patch still applies on top of the first. I did the doc tests in
sage/rings and sage/categories with the first patch, but full doc tests
should be run with both patches, of course.
Apply trac9138-categories_for_rings.patch
trac9138_categories_for_more_rings.rebase4.7.1.a1.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9138#comment:76>
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.