Skip to content

Commit

Permalink
Trac #34453: Tensor products of commutative algebras do not know they…
Browse files Browse the repository at this point in the history
… are commutative rings

{{{
sage: X = algebras.Shuffle(QQ, 'ab')
sage: Y = algebras.Shuffle(QQ, 'bc')
sage: X in CommutativeRings()
True
sage: Y in CommutativeRings()
True
sage: T = tensor([X,Y])
sage: T in CommutativeRings()
False
}}}

URL: https://trac.sagemath.org/34453
Reported by: tscrim
Ticket author(s): Travis Scrimshaw
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager committed Sep 20, 2022
2 parents 53a523e + 5776c61 commit 5a41c49
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/sage/categories/commutative_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
# http://www.gnu.org/licenses/
#******************************************************************************

from sage.misc.cachefunc import cached_method
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
from sage.categories.algebras import Algebras
from sage.categories.commutative_rings import CommutativeRings
from sage.categories.tensor import TensorProductsCategory

class CommutativeAlgebras(CategoryWithAxiom_over_base_ring):
"""
Expand All @@ -36,7 +39,7 @@ class CommutativeAlgebras(CategoryWithAxiom_over_base_ring):
True
sage: TestSuite(CommutativeAlgebras(ZZ)).run()
Todo:
.. TODO::
- product ( = Cartesian product)
- coproduct ( = tensor product over base ring)
Expand All @@ -58,3 +61,32 @@ def __contains__(self, A):
"""
return super().__contains__(A) or \
(A in Algebras(self.base_ring()) and hasattr(A, "is_commutative") and A.is_commutative())

class TensorProducts(TensorProductsCategory):
"""
The category of commutative algebras constructed by tensor product of commutative algebras.
"""

@cached_method
def extra_super_categories(self):
"""
EXAMPLES::
sage: Algebras(QQ).Commutative().TensorProducts().extra_super_categories()
[Category of commutative rings]
sage: Algebras(QQ).Commutative().TensorProducts().super_categories()
[Category of tensor products of algebras over Rational Field,
Category of commutative algebras over Rational Field]
TESTS::
sage: X = algebras.Shuffle(QQ, 'ab')
sage: Y = algebras.Shuffle(QQ, 'bc')
sage: X in Algebras(QQ).Commutative()
True
sage: T = tensor([X, Y])
sage: T in CommutativeRings()
True
"""
return [CommutativeRings()]

0 comments on commit 5a41c49

Please sign in to comment.