Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac 15801: little fix in polynomial_default_category, and update doc…
Browse files Browse the repository at this point in the history
…tests involving categories of polynomial rings
  • Loading branch information
nthiery committed Apr 14, 2014
1 parent 42ab3cd commit 9cc7ef4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
24 changes: 15 additions & 9 deletions src/sage/rings/polynomial/polynomial_ring_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,27 +617,33 @@ def polynomial_default_category(base_ring_category, multivariate):
EXAMPLES::
sage: QQ['t'].category() is Category.join([EuclideanDomains(), CommutativeAlgebras(QQ.category())])
sage: from sage.rings.polynomial.polynomial_ring_constructor import polynomial_default_category
sage: polynomial_default_category(Rings(), False) is Algebras(Rings())
True
sage: QQ['s','t'].category() is Category.join([UniqueFactorizationDomains(), CommutativeAlgebras(QQ.category())])
sage: polynomial_default_category(Rings().Commutative(),False) is Algebras(Rings().Commutative()).Commutative()
True
sage: QQ['s']['t'].category() is Category.join([UniqueFactorizationDomains(), CommutativeAlgebras(QQ['s'].category())])
sage: polynomial_default_category(Fields(),False) is EuclideanDomains() & Algebras(Fields())
True
sage: polynomial_default_category(Fields(),True) is UniqueFactorizationDomains() & CommutativeAlgebras(Fields())
True
sage: QQ['t'].category() is EuclideanDomains() & CommutativeAlgebras(QQ.category())
True
sage: QQ['s','t'].category() is UniqueFactorizationDomains() & CommutativeAlgebras(QQ.category())
True
sage: QQ['s']['t'].category() is UniqueFactorizationDomains() & CommutativeAlgebras(QQ['s'].category())
True
"""
category = Algebras(base_ring_category)
if base_ring_category.is_subcategory(_Fields):
if multivariate:
return category & _UniqueFactorizationDomains
else:
return category & _EuclideanDomains
if base_ring_category.is_subcategory(_Fields) and not multivariate:
return category & _EuclideanDomains
elif base_ring_category.is_subcategory(_UniqueFactorizationDomains):
return category & _UniqueFactorizationDomains
elif base_ring_category.is_subcategory(_IntegralDomains):
return category & _IntegralDomains
elif base_ring_category.is_subcategory(_CommutativeRings):
return category & _CommutativeRings
return base_ring_category
return category

def BooleanPolynomialRing_constructor(n=None, names=None, order="lex"):
"""
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ cdef class Ring(ParentWithGens):
Test agaings another bug fixed in :trac:`9944`::
sage: QQ['x'].category()
Join of Category of euclidean domains and Category of commutative algebras over Rational Field
Join of Category of euclidean domains and Category of commutative algebras over quotient fields
sage: QQ['x','y'].category()
Join of Category of unique factorization domains and Category of commutative algebras over Rational Field
Join of Category of unique factorization domains and Category of commutative algebras over quotient fields
sage: PolynomialRing(MatrixSpace(QQ,2),'x').category()
Category of algebras over Full MatrixSpace of 2 by 2 dense matrices over Rational Field
Category of algebras over algebras over quotient fields
sage: PolynomialRing(SteenrodAlgebra(2),'x').category()
Category of algebras over mod 2 Steenrod algebra, milnor basis
Category of algebras over graded hopf algebras with basis over Finite Field of size 2
TESTS::
Expand Down

0 comments on commit 9cc7ef4

Please sign in to comment.