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

Commit

Permalink
Merge branch 'public/lie_algebras/base_class_nilponent-26074' of git:…
Browse files Browse the repository at this point in the history
…//trac.sagemath.org/sage into public/lie_algebras/base_class_nilponent-26074
  • Loading branch information
tscrim committed Aug 21, 2018
2 parents 23a2b10 + f1a0b1e commit a3dccfd
Show file tree
Hide file tree
Showing 13 changed files with 769 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/doc/en/reference/categories/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Individual Categories
sage/categories/finite_dimensional_algebras_with_basis
sage/categories/finite_dimensional_bialgebras_with_basis
sage/categories/finite_dimensional_coalgebras_with_basis
sage/categories/finite_dimensional_graded_lie_algebras_with_basis
sage/categories/finite_dimensional_hopf_algebras_with_basis
sage/categories/finite_dimensional_lie_algebras_with_basis
sage/categories/finite_dimensional_modules_with_basis
Expand Down Expand Up @@ -107,6 +108,8 @@ Individual Categories
sage/categories/graded_coalgebras_with_basis
sage/categories/graded_hopf_algebras
sage/categories/graded_hopf_algebras_with_basis
sage/categories/graded_lie_algebras
sage/categories/graded_lie_algebras_with_basis
sage/categories/graded_modules
sage/categories/graded_modules_with_basis
sage/categories/graphs
Expand Down Expand Up @@ -228,6 +231,7 @@ Examples of parents using categories
sage/categories/examples/finite_dimensional_algebras_with_basis
sage/categories/examples/finite_enumerated_sets
sage/categories/examples/finite_dimensional_lie_algebras_with_basis
sage/categories/examples/finite_dimensional_nilpotent_lie_algebras_with_basis
sage/categories/examples/finite_monoids
sage/categories/examples/finite_semigroups
sage/categories/examples/finite_weyl_groups
Expand Down
3 changes: 3 additions & 0 deletions src/sage/algebras/lie_algebras/abelian.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(self, R, names, index_set, **kwds):
sage: L = LieAlgebra(QQ, 3, 'x', abelian=True)
sage: TestSuite(L).run()
"""
category = kwds.get("category", None)
kwds["category"] = LieAlgebras(R).FiniteDimensional().WithBasis() \
.Nilpotent().or_subcategory(category)
LieAlgebraWithStructureCoefficients.__init__(self, R, Family({}), names, index_set, **kwds)

def _repr_(self):
Expand Down
35 changes: 31 additions & 4 deletions src/sage/algebras/lie_algebras/heisenberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ def _latex_term(self, m):
return m
return "%s_{%s}"%(m[0], m[1:]) # else it is of length at least 2

def step(self):
r"""
Return the nilpotency step of ``self``.
EXAMPLES::
sage: h = lie_algebras.Heisenberg(ZZ, 10)
sage: h.step()
2
sage: h = lie_algebras.Heisenberg(ZZ, oo)
sage: h.step()
2
"""
return Integer(2)

class Element(LieAlgebraElement):
pass

Expand Down Expand Up @@ -353,7 +369,7 @@ def __init__(self, R, n):
+ ['q%s'%i for i in range(1,n+1)]
+ ['z'])
LieAlgebraWithGenerators.__init__(self, R, names=names, index_set=names,
category=LieAlgebras(R).FiniteDimensional().WithBasis())
category=LieAlgebras(R).Nilpotent().FiniteDimensional().WithBasis())
HeisenbergAlgebra_abstract.__init__(self, names)

def _repr_(self):
Expand Down Expand Up @@ -389,7 +405,7 @@ def __init__(self, R):
True
"""
S = cartesian_product([PositiveIntegers(), ['p','q']])
cat = LieAlgebras(R).WithBasis()
cat = LieAlgebras(R).Nilpotent().WithBasis()
LieAlgebraWithGenerators.__init__(self, R, index_set=S, category=cat)
HeisenbergAlgebra_abstract.__init__(self, S)

Expand Down Expand Up @@ -427,7 +443,6 @@ def lie_algebra_generators(self):
sage: L.lie_algebra_generators()
Lazy family (generator map(i))_{i in The Cartesian product of
(Positive integers, {'p', 'q'})}
"""
return Family(self._indices, lambda x: self.monomial(x[1] + str(x[0])),
name='generator map')
Expand Down Expand Up @@ -652,7 +667,7 @@ def __init__(self, R, n):
z = (MS({(0,n+1): one}),)
names = tuple('p%s'%i for i in range(1,n+1))
names = names + tuple('q%s'%i for i in range(1,n+1)) + ('z',)
cat = LieAlgebras(R).FiniteDimensional().WithBasis()
cat = LieAlgebras(R).Nilpotent().FiniteDimensional().WithBasis()
LieAlgebraFromAssociative.__init__(self, MS, p + q + z, names=names,
index_set=names, category=cat)

Expand Down Expand Up @@ -711,6 +726,18 @@ def z(self):
"""
return self._gens['z']

def step(self):
r"""
Return the nilpotency step of ``self``.
EXAMPLES::
sage: h = lie_algebras.Heisenberg(ZZ, 2, representation="matrix")
sage: h.step()
2
"""
return Integer(2)

class Element(LieAlgebraMatrixWrapper, LieAlgebraFromAssociative.Element):
def monomial_coefficients(self, copy=True):
"""
Expand Down
38 changes: 34 additions & 4 deletions src/sage/algebras/lie_algebras/lie_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,31 @@ class LieAlgebra(Parent, UniqueRepresentation): # IndexedGenerators):
sage: P.bracket(a, b) + P.bracket(a - c, b + 3*c)
2*a*b + 3*a*c - 2*b*a + b*c - 3*c*a - c*b
**6.** Nilpotent Lie algebras are Lie algebras such that there exists an
integer `s` such that all iterated brackets of length longer than `s`
are zero. They can be constructed from structural coefficients using the
``nilpotent`` keyword::
sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)
sage: L
Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field
sage: L.category()
Category of finite dimensional nilpotent lie algebras with basis over Rational Field
A second example defining the Engel Lie algebra::
sage: sc = {('X','Y'): {'Z': 1}, ('X','Z'): {'W': 1}}
sage: E.<X,Y,Z,W> = LieAlgebra(QQ, sc, nilpotent=True); E
Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field
sage: E.step()
3
sage: E[X, Y + Z]
Z + W
sage: E[X, [X, Y + Z]]
W
sage: E[X, [X, [X, Y + Z]]]
0
REFERENCES:
- [deG2000]_ Willem A. de Graaf. *Lie Algebras: Theory and Algorithms*.
Expand All @@ -297,7 +322,8 @@ class LieAlgebra(Parent, UniqueRepresentation): # IndexedGenerators):
# __classcall_private__ will only be called when calling LieAlgebra
@staticmethod
def __classcall_private__(cls, R=None, arg0=None, arg1=None, names=None,
index_set=None, abelian=False, **kwds):
index_set=None, abelian=False,
nilpotent=False, **kwds):
"""
Select the correct parent based upon input.
Expand Down Expand Up @@ -376,6 +402,10 @@ def __classcall_private__(cls, R=None, arg0=None, arg1=None, names=None,

if isinstance(arg1, dict):
# Assume it is some structure coefficients
if nilpotent:
from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense
return NilpotentLieAlgebra_dense(R, arg1, names, index_set, **kwds)

from sage.algebras.lie_algebras.structure_coefficients import LieAlgebraWithStructureCoefficients
return LieAlgebraWithStructureCoefficients(R, arg1, names, index_set, **kwds)

Expand Down Expand Up @@ -434,7 +464,7 @@ def __init__(self, R, names=None, category=None):
sage: L.<x,y> = LieAlgebra(QQ, abelian=True)
sage: L.category()
Category of finite dimensional lie algebras with basis over Rational Field
Category of finite dimensional nilpotent lie algebras with basis over Rational Field
"""
category = LieAlgebras(R).or_subcategory(category)
Parent.__init__(self, base=R, names=names, category=category)
Expand Down Expand Up @@ -671,7 +701,7 @@ def __init__(self, R, names=None, index_set=None, category=None, prefix='L', **k
sage: L.<x,y> = LieAlgebra(QQ, abelian=True)
sage: L.category()
Category of finite dimensional lie algebras with basis over Rational Field
Category of finite dimensional nilpotent lie algebras with basis over Rational Field
"""
self._indices = index_set
LieAlgebra.__init__(self, R, names, category)
Expand Down Expand Up @@ -755,7 +785,7 @@ def __init__(self, R, names=None, index_set=None, category=None):
sage: L.<x,y> = LieAlgebra(QQ, abelian=True)
sage: L.category()
Category of finite dimensional lie algebras with basis over Rational Field
Category of finite dimensional nilpotent lie algebras with basis over Rational Field
"""
LieAlgebraWithGenerators.__init__(self, R, names, index_set, category)
self.__ngens = len(self._indices)
Expand Down
144 changes: 144 additions & 0 deletions src/sage/algebras/lie_algebras/nilpotent_lie_algebra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
r"""
Nilpotent Lie algebras
AUTHORS:
- Eero Hakavuori (2018-08-16): initial version
"""

# ****************************************************************************
# Copyright (C) 2018 Eero Hakavuori <eero.hakavuori@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.algebras.lie_algebras.structure_coefficients import LieAlgebraWithStructureCoefficients
from sage.categories.lie_algebras import LieAlgebras


class NilpotentLieAlgebra_dense(LieAlgebraWithStructureCoefficients):
r"""
A nilpotent Lie algebra `L` over a base ring.
INPUT:
- ``R`` -- the base ring
- ``s_coeff`` -- a dictionary of structural coefficients
- ``names`` -- (default:``None``) list of strings to use as names of basis
elements; if ``None``, the names will be inferred from the structural
coefficients
- ``index_set`` -- (default:``None``) list of hashable and comparable
elements to use for indexing
- ``step`` -- (optional) an integer; the nilpotency step of the
Lie algebra if known; otherwise it will be computed when needed
- ``category`` -- (optional) a subcategory of finite dimensional
nilpotent Lie algebras with basis
EXAMPLES:
The input to a :class:`NilpotentLieAlgebra_dense` should be of the
same form as to a
:class:`~sage.algebras.lie_algebras.structure_coefficients.LieAlgebraWithStructureCoefficients`::
sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)
sage: L
Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field
sage: L[X, Y]
Z
sage: L[X, W]
0
If the parameter ``names`` is omitted, then the terms appearing in the
structural coefficients are used as names::
sage: L = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True); L
Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field
TESTS::
sage: L = LieAlgebra(QQ, {('X','Y'): {'Z': 1},
....: ('X','Z'): {'W': 1},
....: ('Y','Z'): {'T': 1}}, nilpotent=True)
sage: TestSuite(L).run()
"""
@staticmethod
def __classcall_private__(cls, R, s_coeff, names=None, index_set=None, **kwds):
"""
Normalize input to ensure a unique representation.
EXAMPLES:
If the variable order is specified, the order of structural
coefficients does not matter::
sage: from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense
sage: L1.<x,y,z> = NilpotentLieAlgebra_dense(QQ, {('x','y'): {'z': 1}})
sage: L2.<x,y,z> = NilpotentLieAlgebra_dense(QQ, {('y','x'): {'z': -1}})
sage: L1 is L2
True
If the variables are implicitly defined by the structural coefficients,
the ordering may be different and the Lie algebras will be considered
different::
sage: from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense
sage: L1 = NilpotentLieAlgebra_dense(QQ, {('x','y'): {'z': 1}})
sage: L2 = NilpotentLieAlgebra_dense(QQ, {('y','x'): {'z': -1}})
sage: L1
Nilpotent Lie algebra on 3 generators (x, y, z) over Rational Field
sage: L2
Nilpotent Lie algebra on 3 generators (y, x, z) over Rational Field
sage: L1 is L2
False
"""
if not names:
# extract names from structural coefficients
names = []
for (X, Y), d in s_coeff.items():
if X not in names: names.append(X)
if Y not in names: names.append(Y)
for k in d:
if k not in names: names.append(k)

from sage.structure.indexed_generators import standardize_names_index_set
names, index_set = standardize_names_index_set(names, index_set)
s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff(
s_coeff, index_set)

return super(NilpotentLieAlgebra_dense, cls).__classcall__(
cls, R, s_coeff, names, index_set, **kwds)

def __init__(self, R, s_coeff, names, index_set, step=None,
category=None, **kwds):
r"""
Initialize ``self``.
EXAMPLES::
sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)
sage: TestSuite(L).run()
"""
if step:
self._step = step

cat = LieAlgebras(R).FiniteDimensional().WithBasis().Nilpotent()
cat = cat.or_subcategory(category)
LieAlgebraWithStructureCoefficients.__init__(self, R, s_coeff,
names, index_set,
category=cat, **kwds)

def _repr_(self):
"""
Return a string representation of ``self``.
EXAMPLES::
sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)
sage: L
Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field
"""
return "Nilpotent %s" % (super(NilpotentLieAlgebra_dense, self)._repr_())
3 changes: 2 additions & 1 deletion src/sage/categories/category_with_axiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,8 @@ class ``Sets.Finite``), or in a separate file (typically in a class
"AdditiveCommutative", "AdditiveAssociative", "AdditiveInverse", "AdditiveUnital",
"Distributive",
"Endset",
"Pointed"
"Pointed",
"Stratified", "Nilpotent"
)

def uncamelcase(s,separator=" "):
Expand Down
Loading

0 comments on commit a3dccfd

Please sign in to comment.