# Ticket #8589: trac_8589_feature_group_algebras_vf.2.patch

File trac_8589_feature_group_algebras_vf.2.patch, 15.9 KB (added by vferay, 11 years ago)
• ## sage/categories/algebra_functor.py

# HG changeset patch
# User Valentin Feray <feray at labri.fr>
# Date 1287155720 -7200
# Node ID a74eab6e29fee2a80754db03a146113dafb0700c
# Parent  0eec06f001782d0d73c763f5e2545b04cf737577
#8589 : added some features on group algebras

diff --git a/sage/categories/algebra_functor.py b/sage/categories/algebra_functor.py
 a def Algebras(self, base_ring): sage: Monoids().Algebras(QQ) Category of monoid algebras over Rational Field sage: Groups().Algebras(QQ) # todo: update once there will be a category for group algebras Category of monoid algebras over Rational Field sage: Groups().Algebras(QQ) Category of group algebras over Rational Field sage: M = Monoids().example(); M An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
• ## sage/categories/coalgebras.py

diff --git a/sage/categories/coalgebras.py b/sage/categories/coalgebras.py
 a class Coalgebras(Category_over_base_ring return tensor([self, self]) @abstract_method def counit(self, x): """ Returns the counit of x. Eventually, there will be a default implementation, delegating to the overloading mechanism and forcing the conversion back EXAMPLES:: sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field sage: [a,b] = A.algebra_generators() sage: a, A.counit(a) (B[(1,2,3)], 1) sage: b, A.counit(b) (B[(1,3)], 1) TODO: implement some tests of the axioms of coalgebras, bialgebras and Hopf algebras using the counit. """ @abstract_method def coproduct(self, x): """ Returns the coproduct of x. class Coalgebras(Category_over_base_ring """ return self.parent().coproduct(self) def counit(self): """ Returns the counit of self EXAMPLES:: sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field sage: [a,b] = A.algebra_generators() sage: a, a.counit() (B[(1,2,3)], 1) sage: b, b.counit() (B[(1,3)], 1) """ return self.parent().counit(self) class TensorProducts(TensorProductsCategory): @cached_method
• ## sage/categories/coalgebras_with_basis.py

diff --git a/sage/categories/coalgebras_with_basis.py b/sage/categories/coalgebras_with_basis.py
 a class CoalgebrasWithBasis(Category_over_ @abstract_method(optional = True) def coproduct_on_basis(self, i): """ The product of the algebra on the basis (optional) The coproduct of the algebra on the basis (optional) INPUT: - i: the indices of an element of the basis of self class CoalgebrasWithBasis(Category_over_ sage: A.coproduct_on_basis(a) B[(1,2,3)] # B[(1,2,3)] """ @abstract_method(optional = True) def counit_on_basis(self, i): """ The counit of the algebra on the basis (optional) INPUT: - i: the indices of an element of the basis of self Returns the counit of the corresponding basis elements If implemented, the counit of the algebra is defined from it by linearity. EXAMPLES:: sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field sage: (a, b) = A._group.gens() sage: A.counit_on_basis(a) 1 """ class ParentMethods: @lazy_attribute def coproduct(self): """ If :meth:.coproduct_basis is available, construct the If :meth:.coproduct_on_basis is available, construct the coproduct morphism from self to self \otimes self by extending it by linearity class CoalgebrasWithBasis(Category_over_ # should there be a method self.coproduct_hom_category? return Hom(self, tensor([self, self]), ModulesWithBasis(self.base_ring()))(on_basis = self.coproduct_on_basis) @lazy_attribute def counit(self): """ If :meth:.counit_on_basis is available, construct the counit morphism from self to self \otimes self by extending it by linearity EXAMPLES:: sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field sage: [a,b] = A.algebra_generators() sage: a, A.counit(a) (B[(1,2,3)], 1) sage: b, A.counit(b) (B[(1,3)], 1) """ if self.counit_on_basis is not NotImplemented: return self.module_morphism(self.counit_on_basis,codomain=self.base_ring()) class ElementMethods: pass
• ## sage/categories/examples/hopf_algebras_with_basis.py

diff --git a/sage/categories/examples/hopf_algebras_with_basis.py b/sage/categories/examples/hopf_algebras_with_basis.py
 a class MyGroupAlgebra(CombinatorialFreeMo g = self.monomial(g) return tensor([g, g]) def counit_on_basis(self, g): r""" Counit, on basis elements, as per :meth:HopfAlgebrasWithBasis.ParentMethods.counit_on_basis. The counit on the basis elements is 1. EXAMPLES:: sage: A = HopfAlgebrasWithBasis(QQ).example() sage: (a, b) = A._group.gens() sage: A.counit_on_basis(a) 1 """ return self.base_ring().one() def antipode_on_basis(self, g): r""" Antipode, on basis elements, as per :meth:HopfAlgebrasWithBasis.ParentMethods.antipode_on_basis.
• ## sage/categories/finite_groups.py

diff --git a/sage/categories/finite_groups.py b/sage/categories/finite_groups.py
 a class FiniteGroups(Category): sage: A = AlternatingGroup(4) sage: A.semigroup_generators() [(1,2,3), (2,3,4)] Family ((1,2,3), (2,3,4)) """ return self.group_generators()
• ## sage/categories/groups.py

diff --git a/sage/categories/groups.py b/sage/categories/groups.py
 a Groups from sage.misc.cachefunc import cached_method from sage.categories.category import Category from sage.categories.monoids import Monoids from sage.categories.algebra_functor import AlgebrasCategory class Groups(Category): """ class Groups(Category): """ return [Monoids()] def example(self): from sage.rings.rational_field import QQ from sage.groups.matrix_gps.general_linear import GL """ EXAMPLES:: sage: Groups().example() General Linear Group of degree 4 over Rational Field """ return GL(4,QQ) class ParentMethods: def group_generators(self): from sage.sets.family import Family """ Returns group generators for self. class Groups(Category): sage: A = AlternatingGroup(4) sage: A.group_generators() [(1,2,3), (2,3,4)] Family ((1,2,3), (2,3,4)) """ return self.gens() return Family(self.gens()) def _test_inverse(self, **options): """ class Groups(Category): sage: G = SymmetricGroup(3) sage: G._test_inverse() """ tester = self._tester(**options) for x in tester.some_elements(): class Groups(Category): class ElementMethods: ## inv(x), x/y pass class Algebras(AlgebrasCategory): def extra_super_categories(self): """ EXAMPLES:: sage: Groups().Algebras(QQ).super_categories() [Category of hopf algebras with basis over Rational Field, Category of monoid algebras over Rational Field] sage: Groups().example().algebra(ZZ).categories() [Category of group algebras over Integer Ring, Category of hopf algebras with basis over Integer Ring, Category of bialgebras with basis over Integer Ring, Category of coalgebras with basis over Integer Ring, Category of hopf algebras over Integer Ring, Category of bialgebras over Integer Ring, Category of coalgebras over Integer Ring, Category of monoid algebras over Integer Ring, Category of semigroup algebras over Integer Ring, Category of algebras with basis over Integer Ring, Category of algebras over Integer Ring, Category of rings, Category of rngs, Category of semirings, Category of monoids, Category of semigroups, Category of magmas, Category of set algebras over Integer Ring, Category of modules with basis over Integer Ring, Category of modules over Integer Ring, Category of bimodules over Integer Ring on the left and Integer Ring on the right, Category of left modules over Integer Ring, Category of right modules over Integer Ring, Category of commutative additive groups, Category of commutative additive monoids, Category of commutative additive semigroups, Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects] """ from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis return [HopfAlgebrasWithBasis(self.base_ring())] class ParentMethods: def _repr_(self): r""" Print the string representation of self. For the moment, this function is not used because it is defined in a higher category. """ return 'Group algebra of %s over %s'%(self.basis().keys(),self.base_ring()) def coproduct_on_basis(self, g): r""" Returns the coproduct of the element of the basis (which are group-like). Used to compute the coproduct of any element. EXAMPLES:: sage: A=CyclicPermutationGroup(6).algebra(ZZ);A Group algebra of Cyclic group of order 6 as a permutation group over Integer Ring sage: g=CyclicPermutationGroup(6).an_element();g (1,2,3,4,5,6) sage: A.coproduct_on_basis(g) B[(1,2,3,4,5,6)] # B[(1,2,3,4,5,6)] sage: a=A.an_element();a B[()] + 3*B[(1,2,3,4,5,6)] + 3*B[(1,3,5)(2,4,6)] sage: a.coproduct() B[()] # B[()] + 3*B[(1,2,3,4,5,6)] # B[(1,2,3,4,5,6)] + 3*B[(1,3,5)(2,4,6)] # B[(1,3,5)(2,4,6)] """ from sage.categories.tensor import tensor g = self.term(g) return tensor([g, g]) def antipode_on_basis(self,g): r""" Returns the antipode of the element of the basis (which are group- like). Used to compute the antipode of any element. EXAMPLES:: sage: A=CyclicPermutationGroup(6).algebra(ZZ);A Group algebra of Cyclic group of order 6 as a permutation group over Integer Ring sage: g=CyclicPermutationGroup(6).an_element();g (1,2,3,4,5,6) sage: A.antipode_on_basis(g) B[(1,6,5,4,3,2)] sage: a=A.an_element();a B[()] + 3*B[(1,2,3,4,5,6)] + 3*B[(1,3,5)(2,4,6)] sage: a.antipode() B[()] + 3*B[(1,5,3)(2,6,4)] + 3*B[(1,6,5,4,3,2)] """ return self.term(g**(-1)) def counit_on_basis(self,g): r""" Returns the counit of the element of the basis, that is 1 in a group algebra. EXAMPLES:: sage: A=CyclicPermutationGroup(6).algebra(ZZ);A Group algebra of Cyclic group of order 6 as a permutation group over Integer Ring sage: g=CyclicPermutationGroup(6).an_element();g (1,2,3,4,5,6) sage: A.counit_on_basis(g) 1 """ return self.base_ring().one() def counit(self,x): r""" Returns the counit of the element x, that is the sum of the coefficient in a group algebra. EXAMPLES:: sage: A=CyclicPermutationGroup(6).algebra(ZZ);A Group algebra of Cyclic group of order 6 as a permutation group over Integer Ring sage: a=A.an_element();a B[()] + 3*B[(1,2,3,4,5,6)] + 3*B[(1,3,5)(2,4,6)] sage: a.counit() 7 """ return sum(x.coefficients()) class ElementMethods: pass
• ## sage/categories/monoids.py

diff --git a/sage/categories/monoids.py b/sage/categories/monoids.py
 a class Monoids(Category): 3*B[''] """ return self.basis().keys().one() def an_element(self): r""" Returns an element of self. For the moment, this function is not used because it is defined in a higher category """ return (2*self(self.basis().keys().an_element())+ self.base_ring().an_element * self.one()) class ElementMethods: def is_central(self): r""" Returns True if the element is central and False otherwise. EXAMPLES:: sage: A=DihedralGroup(5).algebra(QQ) sage: sum(i for i in A.basis()).is_central() True """ gen=self.parent().algebra_generators() for i in gen: if i*self != self*i: return False return True
• ## sage/categories/semigroups.py

diff --git a/sage/categories/semigroups.py b/sage/categories/semigroups.py
 a class Semigroups(Category): @cached_method def algebra_generators(self): from sage.sets.family import Family r""" The generators of this algebra, as per :meth:`Algebras.ParentMethods.algebra_generators()