code stringlengths 17 6.64M |
|---|
def upper_triangular_matrices(R, n):
'\n Return the Lie algebra `\\mathfrak{b}_k` of `k \\times k` upper\n triangular matrices.\n\n .. TODO::\n\n This implementation does not know it is finite-dimensional and\n does not know its basis.\n\n EXAMPLES::\n\n sage: L = lie_algebras.upper_triangular_matrices(QQ, 4); L\n Lie algebra of 4-dimensional upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n sage: n0, n1, n2, t0, t1, t2, t3 = L.lie_algebra_generators()\n sage: L[n2, t2] == -n2\n True\n\n TESTS::\n\n sage: L = lie_algebras.upper_triangular_matrices(QQ, 1); L\n Lie algebra of 1-dimensional upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n sage: L = lie_algebras.upper_triangular_matrices(QQ, 0); L\n Lie algebra of 0-dimensional upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n '
from sage.matrix.matrix_space import MatrixSpace
from sage.algebras.lie_algebras.lie_algebra import LieAlgebraFromAssociative
MS = MatrixSpace(R, n, sparse=True)
one = R.one()
names = tuple(('n{}'.format(i) for i in range((n - 1))))
names += tuple(('t{}'.format(i) for i in range(n)))
gens = [MS({(i, (i + 1)): one}) for i in range((n - 1))]
gens += [MS({(i, i): one}) for i in range(n)]
L = LieAlgebraFromAssociative(MS, gens, names=names)
L.rename('Lie algebra of {}-dimensional upper triangular matrices over {}'.format(n, L.base_ring()))
return L
|
def strictly_upper_triangular_matrices(R, n):
'\n Return the Lie algebra `\\mathfrak{n}_k` of strictly `k \\times k` upper\n triangular matrices.\n\n .. TODO::\n\n This implementation does not know it is finite-dimensional and\n does not know its basis.\n\n EXAMPLES::\n\n sage: L = lie_algebras.strictly_upper_triangular_matrices(QQ, 4); L\n Lie algebra of 4-dimensional strictly upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n sage: n0, n1, n2 = L.lie_algebra_generators()\n sage: L[n2, n1]\n [ 0 0 0 0]\n [ 0 0 0 -1]\n [ 0 0 0 0]\n [ 0 0 0 0]\n\n TESTS::\n\n sage: L = lie_algebras.strictly_upper_triangular_matrices(QQ, 1); L\n Lie algebra of 1-dimensional strictly upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n sage: L = lie_algebras.strictly_upper_triangular_matrices(QQ, 0); L\n Lie algebra of 0-dimensional strictly upper triangular matrices over Rational Field\n sage: TestSuite(L).run()\n '
from sage.matrix.matrix_space import MatrixSpace
from sage.algebras.lie_algebras.lie_algebra import LieAlgebraFromAssociative
MS = MatrixSpace(R, n, sparse=True)
one = R.one()
names = tuple(('n{}'.format(i) for i in range((n - 1))))
gens = tuple((MS({(i, (i + 1)): one}) for i in range((n - 1))))
L = LieAlgebraFromAssociative(MS, gens, names=names)
L.rename('Lie algebra of {}-dimensional strictly upper triangular matrices over {}'.format(n, L.base_ring()))
return L
|
def sl(R, n, representation='bracket'):
"\n The Lie algebra `\\mathfrak{sl}_n`.\n\n The Lie algebra `\\mathfrak{sl}_n` is the type `A_{n-1}` Lie algebra\n and is finite dimensional. As a matrix Lie algebra, it is given by\n the set of all `n \\times n` matrices with trace 0.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the size of the matrix\n - ``representation`` -- (default: ``'bracket'``) can be one of\n the following:\n\n * ``'bracket'`` - use brackets and the Chevalley basis\n * ``'matrix'`` - use matrices\n\n EXAMPLES:\n\n We first construct `\\mathfrak{sl}_2` using the Chevalley basis::\n\n sage: sl2 = lie_algebras.sl(QQ, 2); sl2\n Lie algebra of ['A', 1] in the Chevalley basis\n sage: E,F,H = sl2.gens()\n sage: E.bracket(F) == H\n True\n sage: H.bracket(E) == 2*E\n True\n sage: H.bracket(F) == -2*F\n True\n\n We now construct `\\mathfrak{sl}_2` as a matrix Lie algebra::\n\n sage: sl2 = lie_algebras.sl(QQ, 2, representation='matrix')\n sage: E,F,H = sl2.gens()\n sage: E.bracket(F) == H\n True\n sage: H.bracket(E) == 2*E\n True\n sage: H.bracket(F) == -2*F\n True\n "
if (representation == 'bracket'):
from sage.algebras.lie_algebras.classical_lie_algebra import LieAlgebraChevalleyBasis
return LieAlgebraChevalleyBasis(R, ['A', (n - 1)])
if (representation == 'matrix'):
from sage.algebras.lie_algebras.classical_lie_algebra import sl as sl_matrix
return sl_matrix(R, n)
raise ValueError('invalid representation')
|
def su(R, n, representation='matrix'):
"\n The Lie algebra `\\mathfrak{su}_n`.\n\n The Lie algebra `\\mathfrak{su}_n` is the compact real form of the\n type `A_{n-1}` Lie algebra and is finite-dimensional. As a matrix\n Lie algebra, it is given by the set of all `n \\times n` skew-Hermitian\n matrices with trace 0.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the size of the matrix\n - ``representation`` -- (default: ``'matrix'``) can be one of\n the following:\n\n * ``'bracket'`` - use brackets and the Chevalley basis\n * ``'matrix'`` - use matrices\n\n EXAMPLES:\n\n We construct `\\mathfrak{su}_2`, where the default is as a\n matrix Lie algebra::\n\n sage: su2 = lie_algebras.su(QQ, 2)\n sage: E,H,F = su2.basis()\n sage: E.bracket(F) == 2*H\n True\n sage: H.bracket(E) == 2*F\n True\n sage: H.bracket(F) == -2*E\n True\n\n Since `\\mathfrak{su}_n` is the same as the type `A_{n-1}` Lie algebra,\n the bracket is the same as :func:`sl`::\n\n sage: su2 = lie_algebras.su(QQ, 2, representation='bracket')\n sage: su2 is lie_algebras.sl(QQ, 2, representation='bracket')\n True\n "
if (representation == 'bracket'):
from sage.algebras.lie_algebras.classical_lie_algebra import LieAlgebraChevalleyBasis
return LieAlgebraChevalleyBasis(R, ['A', (n - 1)])
if (representation == 'matrix'):
from sage.algebras.lie_algebras.classical_lie_algebra import MatrixCompactRealForm
from sage.combinat.root_system.cartan_type import CartanType
return MatrixCompactRealForm(R, CartanType(['A', (n - 1)]))
raise ValueError('invalid representation')
|
def so(R, n, representation='bracket'):
"\n The Lie algebra `\\mathfrak{so}_n`.\n\n The Lie algebra `\\mathfrak{so}_n` is the type `B_k` Lie algebra\n if `n = 2k - 1` or the type `D_k` Lie algebra if `n = 2k`, and in\n either case is finite dimensional.\n\n A classical description of this as a matrix Lie algebra is\n the set of all anti-symmetric `n \\times n` matrices. However,\n the implementation here uses a different bilinear form for the Lie\n group and follows the description in Chapter 8 of [HK2002]_.\n See :class:`sage.algebras.lie_algebras.classical_lie_algebra.so`\n for a precise description.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the size of the matrix\n - ``representation`` -- (default: ``'bracket'``) can be one of\n the following:\n\n * ``'bracket'`` - use brackets and the Chevalley basis\n * ``'matrix'`` - use matrices\n\n EXAMPLES:\n\n We first construct `\\mathfrak{so}_5` using the Chevalley basis::\n\n sage: so5 = lie_algebras.so(QQ, 5); so5\n Lie algebra of ['B', 2] in the Chevalley basis\n sage: E1,E2, F1,F2, H1,H2 = so5.gens()\n sage: so5([E1, [E1, E2]])\n 0\n sage: X = so5([E2, [E2, E1]]); X\n -2*E[alpha[1] + 2*alpha[2]]\n sage: H1.bracket(X)\n 0\n sage: H2.bracket(X)\n -4*E[alpha[1] + 2*alpha[2]]\n sage: so5([H1, [E1, E2]])\n -E[alpha[1] + alpha[2]]\n sage: so5([H2, [E1, E2]])\n 0\n\n We do the same construction of `\\mathfrak{so}_4` using the Chevalley\n basis::\n\n sage: so4 = lie_algebras.so(QQ, 4); so4\n Lie algebra of ['D', 2] in the Chevalley basis\n sage: E1,E2, F1,F2, H1,H2 = so4.gens()\n sage: H1.bracket(E1)\n 2*E[alpha[1]]\n sage: H2.bracket(E1) == so4.zero()\n True\n sage: E1.bracket(E2) == so4.zero()\n True\n\n We now construct `\\mathfrak{so}_4` as a matrix Lie algebra::\n\n sage: sl2 = lie_algebras.sl(QQ, 2, representation='matrix')\n sage: E1,E2, F1,F2, H1,H2 = so4.gens()\n sage: H2.bracket(E1) == so4.zero()\n True\n sage: E1.bracket(E2) == so4.zero()\n True\n "
if (representation == 'bracket'):
from sage.algebras.lie_algebras.classical_lie_algebra import LieAlgebraChevalleyBasis
if ((n % 2) == 0):
return LieAlgebraChevalleyBasis(R, ['D', (n // 2)])
else:
return LieAlgebraChevalleyBasis(R, ['B', ((n - 1) // 2)])
if (representation == 'matrix'):
from sage.algebras.lie_algebras.classical_lie_algebra import so as so_matrix
return so_matrix(R, n)
raise ValueError('invalid representation')
|
def sp(R, n, representation='bracket'):
"\n The Lie algebra `\\mathfrak{sp}_n`.\n\n The Lie algebra `\\mathfrak{sp}_n` where `n = 2k` is the type `C_k`\n Lie algebra and is finite dimensional. As a matrix Lie algebra, it\n is given by the set of all matrices `X` that satisfy the equation:\n\n .. MATH::\n\n X^T M - M X = 0\n\n where\n\n .. MATH::\n\n M = \\begin{pmatrix}\n 0 & I_k \\\\\n -I_k & 0\n \\end{pmatrix}.\n\n This is the Lie algebra of type `C_k`.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the size of the matrix\n - ``representation`` -- (default: ``'bracket'``) can be one of\n the following:\n\n * ``'bracket'`` - use brackets and the Chevalley basis\n * ``'matrix'`` - use matrices\n\n EXAMPLES:\n\n We first construct `\\mathfrak{sp}_4` using the Chevalley basis::\n\n sage: sp4 = lie_algebras.sp(QQ, 4); sp4\n Lie algebra of ['C', 2] in the Chevalley basis\n sage: E1,E2, F1,F2, H1,H2 = sp4.gens()\n sage: sp4([E2, [E2, E1]])\n 0\n sage: X = sp4([E1, [E1, E2]]); X\n 2*E[2*alpha[1] + alpha[2]]\n sage: H1.bracket(X)\n 4*E[2*alpha[1] + alpha[2]]\n sage: H2.bracket(X)\n 0\n sage: sp4([H1, [E1, E2]])\n 0\n sage: sp4([H2, [E1, E2]])\n -E[alpha[1] + alpha[2]]\n\n We now construct `\\mathfrak{sp}_4` as a matrix Lie algebra::\n\n sage: sp4 = lie_algebras.sp(QQ, 4, representation='matrix'); sp4\n Symplectic Lie algebra of rank 4 over Rational Field\n sage: E1,E2, F1,F2, H1,H2 = sp4.gens()\n sage: H1.bracket(E1)\n [ 0 2 0 0]\n [ 0 0 0 0]\n [ 0 0 0 0]\n [ 0 0 -2 0]\n sage: sp4([E1, [E1, E2]])\n [0 0 2 0]\n [0 0 0 0]\n [0 0 0 0]\n [0 0 0 0]\n "
if (n % 2):
raise ValueError('n must be even')
if (representation == 'bracket'):
from sage.algebras.lie_algebras.classical_lie_algebra import LieAlgebraChevalleyBasis
return LieAlgebraChevalleyBasis(R, ['C', (n // 2)])
if (representation == 'matrix'):
from sage.algebras.lie_algebras.classical_lie_algebra import sp as sp_matrix
return sp_matrix(R, n)
raise ValueError('invalid representation')
|
class FreeLieBasis_abstract(FinitelyGeneratedLieAlgebra, IndexedGenerators, BindableClass):
'\n Abstract base class for all bases of a free Lie algebra.\n '
def __init__(self, lie, basis_name):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.Hall()\n doctest:warning\n ...\n FutureWarning: The Hall basis has not been fully proven correct, but currently no bugs are known\n See https://github.com/sagemath/sage/issues/16823 for details.\n Free Lie algebra generated by (x, y) over Rational Field in the Hall basis\n '
self._basis_name = basis_name
IndexedGenerators.__init__(self, lie._indices, prefix='', bracket=False)
FinitelyGeneratedLieAlgebra.__init__(self, lie.base_ring(), names=lie._names, index_set=lie._indices, category=FreeLieAlgebraBases(lie))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.Hall()\n Free Lie algebra generated by (x, y) over Rational Field in the Hall basis\n sage: L.Lyndon()\n Free Lie algebra generated by (x, y) over Rational Field in the Lyndon basis\n '
return '{0} in the {1} basis'.format(self.realization_of(), self._basis_name)
def _repr_term(self, x):
"\n Return a string representation for ``x``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y')\n sage: H = L.Hall()\n sage: x,y = H.gens()\n sage: H._repr_term(x.leading_support())\n 'x'\n sage: a = H([x, y]).leading_support()\n sage: H._repr_term(a)\n '[x, y]'\n "
return repr(x)
def _latex_term(self, x):
"\n Return a `\\LaTeX` representation for ``x``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y')\n sage: H = L.Hall()\n sage: x,y = H.gens()\n sage: H._latex_term(x.leading_support())\n 'x'\n sage: a = H([x, y]).leading_support()\n sage: H._latex_term(a)\n \\left[ x , y \\right]\n "
return x._latex_()
def _ascii_art_term(self, x):
"\n Return an ascii art representation for ``x``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y')\n sage: H = L.Hall()\n sage: x,y = H.gens()\n sage: H._ascii_art_term(x.leading_support())\n x\n sage: a = H([x, y]).leading_support()\n sage: H._ascii_art_term(a)\n [x, y]\n "
from sage.typeset.ascii_art import ascii_art
return ascii_art(x)
def _unicode_art_term(self, x):
"\n Return a unicode art representation for ``x``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y')\n sage: H = L.Hall()\n sage: x,y = H.gens()\n sage: H._unicode_art_term(x.leading_support())\n x\n sage: a = H([x, y]).leading_support()\n sage: H._unicode_art_term(a)\n [x, y]\n "
from sage.typeset.unicode_art import unicode_art
return unicode_art(x)
def _element_constructor_(self, x):
"\n Convert ``x`` into ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ)\n sage: Lyn = L.Lyndon()\n sage: Lyn('x')\n x\n sage: elt = Lyn([x, y]); elt\n [x, y]\n sage: elt.parent() is Lyn\n True\n "
if ((not isinstance(x, list)) and (x in self._indices)):
return self.monomial(x)
return super()._element_constructor_(x)
def monomial(self, x):
"\n Return the monomial indexed by ``x``.\n\n EXAMPLES::\n\n sage: Lyn = LieAlgebra(QQ, 'x,y').Lyndon()\n sage: x = Lyn.monomial('x'); x\n x\n sage: x.parent() is Lyn\n True\n "
if (not isinstance(x, (LieGenerator, GradedLieBracket))):
if isinstance(x, list):
return super()._element_constructor_(x)
else:
i = self._indices.index(x)
x = LieGenerator(x, i)
return self.element_class(self, {x: self.base_ring().one()})
def _construct_UEA(self):
'\n Construct the universal enveloping algebra of ``self``.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L._construct_UEA()\n Free Algebra on 2 generators (x, y) over Rational Field\n sage: L.<x> = LieAlgebra(QQ)\n sage: L._construct_UEA()\n Free Algebra on 1 generators (x,) over Rational Field\n '
return FreeAlgebra(self.base_ring(), len(self._names), self._names)
def is_abelian(self):
"\n Return ``True`` if this is an abelian Lie algebra.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: L.is_abelian()\n False\n sage: L = LieAlgebra(QQ, 1, 'x')\n sage: L.is_abelian()\n True\n "
return (len(self._indices) <= 1)
def basis(self):
"\n Return the basis of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: L.Hall().basis()\n Disjoint union of Lazy family (graded basis(i))_{i in Positive integers}\n "
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
from sage.sets.positive_integers import PositiveIntegers
from sage.sets.family import Family
return DisjointUnionEnumeratedSets(Family(PositiveIntegers(), self.graded_basis, name='graded basis'))
@cached_method
def graded_dimension(self, k):
"\n Return the dimension of the ``k``-th graded piece of ``self``.\n\n The `k`-th graded part of a free Lie algebra on `n` generators\n has dimension\n\n .. MATH::\n\n \\frac{1}{k} \\sum_{d \\mid k} \\mu(d) n^{k/d},\n\n where `\\mu` is the Mobius function.\n\n REFERENCES:\n\n [MKO1998]_\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x', 3)\n sage: H = L.Hall()\n sage: [H.graded_dimension(i) for i in range(1, 11)]\n [3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]\n sage: H.graded_dimension(0)\n 0\n "
if (k == 0):
return 0
from sage.arith.misc import moebius
s = len(self.lie_algebra_generators())
k = ZZ(k)
return (sum(((moebius(d) * (s ** (k // d))) for d in k.divisors())) // k)
@abstract_method
def graded_basis(self, k):
"\n Return the basis for the ``k``-th graded piece of ``self``.\n\n EXAMPLES::\n\n sage: H = LieAlgebra(QQ, 3, 'x').Hall()\n sage: H.graded_basis(2)\n ([x0, x1], [x0, x2], [x1, x2])\n "
@abstract_method
def _rewrite_bracket(self, l, r):
"\n Rewrite the bracket ``[l, r]`` in terms of the given basis.\n\n INPUT:\n\n - ``l``, ``r`` -- two keys of a basis such that ``l < r``\n\n OUTPUT:\n\n A dictionary ``{b: c}`` where ``b`` is a basis key\n and ``c`` is the corresponding coefficient.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: H = L.Hall()\n sage: x,y,z = H.gens()\n sage: H([x, [y, [z, x]]]) # indirect doctest\n -[y, [x, [x, z]]] - [[x, y], [x, z]]\n "
Element = FreeLieAlgebraElement
|
class FreeLieAlgebra(Parent, UniqueRepresentation):
"\n The free Lie algebra of a set `X`.\n\n The free Lie algebra `\\mathfrak{g}_X` of a set `X` is the Lie algebra\n with generators `\\{g_x\\}_{x \\in X}` where there are no other relations\n beyond the defining relations. This can be constructed as\n the free magmatic algebra `M_X` quotiented by the ideal\n generated by `\\bigl( xx, xy + yx, x(yz) + y(zx) + z(xy) \\bigr)`.\n\n EXAMPLES:\n\n We first construct the free Lie algebra in the Hall basis::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: H = L.Hall()\n sage: x,y,z = H.gens()\n sage: h_elt = H([x, [y, z]]) + H([x - H([y, x]), H([x, z])]); h_elt\n [x, [x, z]] + [y, [x, z]] - [z, [x, y]] + [[x, y], [x, z]]\n\n We can also use the Lyndon basis and go between the two::\n\n sage: Lyn = L.Lyndon()\n sage: l_elt = Lyn([x, [y, z]]) + Lyn([x - Lyn([y, x]), Lyn([x, z])]); l_elt\n [x, [x, z]] + [[x, y], [x, z]] + [x, [y, z]]\n sage: Lyn(h_elt) == l_elt\n True\n sage: H(l_elt) == h_elt\n True\n\n TESTS:\n\n Check that we can convert between the two bases::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: all(Lyn(H(x)) == x for x in Lyn.graded_basis(5))\n True\n sage: all(H(Lyn(x)) == x for x in H.graded_basis(5))\n True\n "
@staticmethod
def __classcall_private__(cls, R, names=None, index_set=None):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.free_lie_algebra import FreeLieAlgebra\n sage: L1 = FreeLieAlgebra(QQ, ['x', 'y', 'z'])\n sage: L2.<x,y,z> = LieAlgebra(QQ)\n sage: L1 is L2\n True\n "
(names, index_set) = standardize_names_index_set(names, index_set)
return super().__classcall__(cls, R, names, index_set)
def __init__(self, R, names, index_set):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: TestSuite(L).run()\n "
self._names = names
self._indices = index_set
Parent.__init__(self, base=R, names=names, category=LieAlgebras(R).WithRealizations())
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: LieAlgebra(QQ, 3, 'x')\n Free Lie algebra generated by (x0, x1, x2) over Rational Field\n "
n = tuple(map(LieGenerator, self._names, range(len(self._names))))
return 'Free Lie algebra generated by {} over {}'.format(n, self.base_ring())
def _construct_UEA(self):
'\n Construct the universal enveloping algebra of ``self``.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L._construct_UEA()\n Free Algebra on 2 generators (x, y) over Rational Field\n '
return FreeAlgebra(self.base_ring(), len(self._names), self._names)
def lie_algebra_generators(self):
"\n Return the Lie algebra generators of ``self`` in the Lyndon basis.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.lie_algebra_generators()\n Finite family {'x': x, 'y': y}\n sage: L.lie_algebra_generators()['x'].parent()\n Free Lie algebra generated by (x, y) over Rational Field in the Lyndon basis\n "
return self.Lyndon().lie_algebra_generators()
def gens(self):
'\n Return the generators of ``self`` in the Lyndon basis.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.gens()\n (x, y)\n sage: L.gens()[0].parent()\n Free Lie algebra generated by (x, y) over Rational Field in the Lyndon basis\n '
return self.Lyndon().gens()
def gen(self, i):
'\n Return the ``i``-th generator of ``self`` in the Lyndon basis.\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.gen(0)\n x\n sage: L.gen(1)\n y\n sage: L.gen(0).parent()\n Free Lie algebra generated by (x, y) over Rational Field in the Lyndon basis\n '
return self.gens()[i]
def a_realization(self):
'\n Return a particular realization of ``self`` (the Lyndon basis).\n\n EXAMPLES::\n\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: L.a_realization()\n Free Lie algebra generated by (x, y) over Rational Field in the Lyndon basis\n '
return self.Lyndon()
class Hall(FreeLieBasis_abstract):
'\n The free Lie algebra in the Hall basis.\n\n The basis keys are objects of class\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.LieObject`,\n each of which is either a\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.LieGenerator`\n (in degree `1`) or a\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.GradedLieBracket`\n (in degree `> 1`).\n '
def __init__(self, lie):
"\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: TestSuite(L.Hall()).run()\n "
experimental_warning(16823, 'The Hall basis has not been fully proven correct, but currently no bugs are known')
FreeLieBasis_abstract.__init__(self, lie, 'Hall')
Lyn = lie.Lyndon()
Hom_HL = Hom(self, Lyn)
Hom_LH = Hom(Lyn, self)
LieAlgebraHomomorphism_im_gens(Hom_HL, Lyn.gens()).register_as_coercion()
LieAlgebraHomomorphism_im_gens(Hom_LH, self.gens()).register_as_coercion()
@cached_method
def _generate_hall_set(self, k):
"\n Generate the Hall set of grade ``k``.\n\n OUTPUT:\n\n A sorted tuple of :class:`GradedLieBracket` elements.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: H = L.Hall()\n sage: H._generate_hall_set(3)\n ([x0, [x0, x1]],\n [x0, [x0, x2]],\n [x1, [x0, x1]],\n [x1, [x0, x2]],\n [x1, [x1, x2]],\n [x2, [x0, x1]],\n [x2, [x0, x2]],\n [x2, [x1, x2]])\n "
if (k <= 0):
return ()
if (k == 1):
return tuple(map(LieGenerator, self.variable_names(), range(len(self.variable_names()))))
if (k == 2):
basis = self._generate_hall_set(1)
ret = []
for (i, a) in enumerate(basis):
for b in basis[(i + 1):]:
ret.append(GradedLieBracket(a, b, 2))
return tuple(ret)
ret = [GradedLieBracket(a, b, k) for i in range(1, ((k + 1) // 2)) for a in self._generate_hall_set(i) for b in self._generate_hall_set((k - i)) if (b._left <= a)]
if (k == 4):
basis = self._generate_hall_set(2)
for (i, a) in enumerate(basis):
for b in basis[(i + 1):]:
ret.append(GradedLieBracket(a, b, k))
elif ((k % 2) == 0):
basis = self._generate_hall_set((k // 2))
for (i, a) in enumerate(basis):
for b in basis[(i + 1):]:
if (b._left <= a):
ret.append(GradedLieBracket(a, b, k))
return tuple(sorted(ret))
@cached_method
def graded_basis(self, k):
"\n Return the basis for the ``k``-th graded piece of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: H = L.Hall()\n sage: H.graded_basis(2)\n ([x, y], [x, z], [y, z])\n sage: H.graded_basis(4)\n ([x, [x, [x, y]]], [x, [x, [x, z]]],\n [y, [x, [x, y]]], [y, [x, [x, z]]],\n [y, [y, [x, y]]], [y, [y, [x, z]]],\n [y, [y, [y, z]]], [z, [x, [x, y]]],\n [z, [x, [x, z]]], [z, [y, [x, y]]],\n [z, [y, [x, z]]], [z, [y, [y, z]]],\n [z, [z, [x, y]]], [z, [z, [x, z]]],\n [z, [z, [y, z]]], [[x, y], [x, z]],\n [[x, y], [y, z]], [[x, z], [y, z]])\n\n TESTS::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', 3)\n sage: H = L.Hall()\n sage: [H.graded_dimension(i) for i in range(1, 11)]\n [3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]\n sage: [len(H.graded_basis(i)) for i in range(1, 11)]\n [3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]\n "
one = self.base_ring().one()
return tuple([self.element_class(self, {x: one}) for x in self._generate_hall_set(k)])
@cached_method
def _rewrite_bracket(self, l, r):
"\n Rewrite the bracket ``[l, r]`` in terms of the Hall basis.\n\n INPUT:\n\n - ``l``, ``r`` -- two keys of the Hall basis with ``l < r``\n\n OUTPUT:\n\n A dictionary ``{b: c}`` where ``b`` is a Hall basis key\n and ``c`` is the corresponding coefficient.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: H = L.Hall()\n sage: x,y,z = H.gens()\n sage: H([x, [y, [z, x]]]) # indirect doctest\n -[y, [x, [x, z]]] - [[x, y], [x, z]]\n "
if ((not isinstance(r, GradedLieBracket)) or (r._left <= l)):
grade = 0
if isinstance(l, GradedLieBracket):
grade += l._grade
else:
grade += 1
if isinstance(r, GradedLieBracket):
grade += r._grade
else:
grade += 1
return {GradedLieBracket(l, r, grade): self.base_ring().one()}
ret = {}
for (m, inner_coeff) in self._rewrite_bracket(l, r._right).items():
if (r._left == m):
continue
elif (r._left < m):
(x, y) = (r._left, m)
else:
(x, y) = (m, r._left)
inner_coeff = (- inner_coeff)
for (b_elt, coeff) in self._rewrite_bracket(x, y).items():
ret[b_elt] = (ret.get(b_elt, 0) + (coeff * inner_coeff))
for (m, inner_coeff) in self._rewrite_bracket(l, r._left).items():
if (m == r._right):
continue
elif (m < r._right):
(x, y) = (m, r._right)
else:
(x, y) = (r._right, m)
inner_coeff = (- inner_coeff)
for (b_elt, coeff) in self._rewrite_bracket(x, y).items():
ret[b_elt] = (ret.get(b_elt, 0) + (coeff * inner_coeff))
return ret
class Lyndon(FreeLieBasis_abstract):
"\n The free Lie algebra in the Lyndon basis.\n\n The basis keys are objects of class\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.LieObject`,\n each of which is either a\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.LieGenerator`\n (in degree `1`) or a\n :class:`~sage.algebras.lie_algebras.lie_algebra_element.LyndonBracket`\n (in degree `> 1`).\n\n TESTS:\n\n We check that :trac:`27069` is fixed::\n\n sage: Lzxy = LieAlgebra(QQ, ['z','x','y']).Lyndon()\n sage: z,x,y = Lzxy.gens(); z,x,y\n (z, x, y)\n sage: z.bracket(x)\n [z, x]\n sage: y.bracket(z)\n -[z, y]\n "
def __init__(self, lie):
"\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, 'x')\n sage: TestSuite(L.Lyndon()).run()\n "
FreeLieBasis_abstract.__init__(self, lie, 'Lyndon')
@cached_method
def _rewrite_bracket(self, l, r):
"\n Rewrite the bracket ``[l, r]`` in terms of the Lyndon basis.\n\n INPUT:\n\n - ``l``, ``r`` -- two keys of the Lyndon basis such\n that ``l < r``\n\n OUTPUT:\n\n A dictionary ``{b: c}`` where ``b`` is a Lyndon basis key\n and ``c`` is the corresponding coefficient.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: x,y,z = Lyn.gens()\n sage: Lyn([x, [y, [z, x]]]) # indirect doctest\n [x, [[x, z], y]]\n "
assert (l < r), ('Order mismatch %s > %s' % (l, r))
if self._is_basis_element(l, r):
grade = 0
if isinstance(l, GradedLieBracket):
grade += l._grade
else:
grade += 1
if isinstance(r, GradedLieBracket):
grade += r._grade
else:
grade += 1
return {LyndonBracket(l, r, grade): self.base_ring().one()}
ret = {}
for (m, inner_coeff) in self._rewrite_bracket(l._right, r).items():
if (l._left == m):
continue
elif (l._left < m):
(x, y) = (l._left, m)
else:
(x, y) = (m, l._left)
inner_coeff = (- inner_coeff)
for (b_elt, coeff) in self._rewrite_bracket(x, y).items():
ret[b_elt] = (ret.get(b_elt, 0) + (coeff * inner_coeff))
for (m, inner_coeff) in self._rewrite_bracket(l._left, r).items():
if (m == l._right):
continue
elif (m < l._right):
(x, y) = (m, l._right)
else:
(x, y) = (l._right, m)
inner_coeff = (- inner_coeff)
for (b_elt, coeff) in self._rewrite_bracket(x, y).items():
ret[b_elt] = (ret.get(b_elt, 0) + (coeff * inner_coeff))
return ret
def _is_basis_element(self, l, r):
"\n Check if the element ``[l, r]`` formed from\n two basis keys ``l`` and ``r`` is a basis key.\n\n EXAMPLES::\n\n sage: Lyn = LieAlgebra(QQ, 'x,y,z').Lyndon()\n sage: all(Lyn._is_basis_element(*x.list()[0][0]) for x in Lyn.graded_basis(4))\n True\n "
w = tuple((l._index_word + r._index_word))
if (not is_lyndon(w)):
return False
b = self._standard_bracket(w)
return ((b._left == l) and (b._right == r))
@cached_method
def _standard_bracket(self, lw):
"\n Return the standard bracketing (a :class:`LieObject`)\n of a Lyndon word ``lw`` using the Lie bracket.\n\n INPUT:\n\n - ``lw`` -- tuple of positive integers that correspond to\n the indices of the generators\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x', 3)\n sage: Lyn = L.Lyndon()\n sage: Lyn._standard_bracket((0, 0, 1))\n [x0, [x0, x1]]\n sage: Lyn._standard_bracket((0, 1, 1))\n [[x0, x1], x1]\n "
if (len(lw) == 1):
i = lw[0]
return LieGenerator(self._indices[i], i)
for i in range(1, len(lw)):
if is_lyndon(lw[i:]):
return LyndonBracket(self._standard_bracket(lw[:i]), self._standard_bracket(lw[i:]), len(lw))
@cached_method
def graded_basis(self, k):
"\n Return the basis for the ``k``-th graded piece of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x', 3)\n sage: Lyn = L.Lyndon()\n sage: Lyn.graded_basis(1)\n (x0, x1, x2)\n sage: Lyn.graded_basis(2)\n ([x0, x1], [x0, x2], [x1, x2])\n sage: Lyn.graded_basis(4)\n ([x0, [x0, [x0, x1]]],\n [x0, [x0, [x0, x2]]],\n [x0, [[x0, x1], x1]],\n [x0, [x0, [x1, x2]]],\n [x0, [[x0, x2], x1]],\n [x0, [[x0, x2], x2]],\n [[x0, x1], [x0, x2]],\n [[[x0, x1], x1], x1],\n [x0, [x1, [x1, x2]]],\n [[x0, [x1, x2]], x1],\n [x0, [[x1, x2], x2]],\n [[[x0, x2], x1], x1],\n [[x0, x2], [x1, x2]],\n [[[x0, x2], x2], x1],\n [[[x0, x2], x2], x2],\n [x1, [x1, [x1, x2]]],\n [x1, [[x1, x2], x2]],\n [[[x1, x2], x2], x2])\n\n TESTS::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', 3)\n sage: Lyn = L.Lyndon()\n sage: [Lyn.graded_dimension(i) for i in range(1, 11)]\n [3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]\n sage: [len(Lyn.graded_basis(i)) for i in range(1, 11)]\n [3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]\n "
if ((k <= 0) or (not self._indices)):
return []
names = self.variable_names()
one = self.base_ring().one()
if (k == 1):
return tuple((self.element_class(self, {LieGenerator(n, k): one}) for (k, n) in enumerate(names)))
from sage.combinat.combinat_cython import lyndon_word_iterator
n = len(self._indices)
ret = []
for lw in lyndon_word_iterator(n, k):
b = self._standard_bracket(tuple(lw))
ret.append(self.element_class(self, {b: one}))
return tuple(ret)
def pbw_basis(self, **kwds):
"\n Return the Poincare-Birkhoff-Witt basis corresponding to ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', 3)\n sage: Lyn = L.Lyndon()\n sage: Lyn.pbw_basis()\n The Poincare-Birkhoff-Witt basis of Free Algebra on 3 generators (x, y, z) over Rational Field\n "
return self.universal_enveloping_algebra().pbw_basis()
poincare_birkhoff_witt_basis = pbw_basis
|
class FreeLieAlgebraBases(Category_realization_of_parent):
'\n The category of bases of a free Lie algebra.\n '
def __init__(self, base):
'\n Initialize the bases of a free Lie algebra.\n\n INPUT:\n\n - ``base`` -- a free Lie algebra\n\n TESTS::\n\n sage: from sage.algebras.lie_algebras.free_lie_algebra import FreeLieAlgebraBases\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: bases = FreeLieAlgebraBases(L)\n sage: L.Hall() in bases\n True\n '
Category_realization_of_parent.__init__(self, base)
def _repr_(self):
'\n Return the representation of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.free_lie_algebra import FreeLieAlgebraBases\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: FreeLieAlgebraBases(L)\n Category of bases of Free Lie algebra generated by (x, y) over Rational Field\n '
return ('Category of bases of %s' % self.base())
def super_categories(self):
'\n The super categories of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.free_lie_algebra import FreeLieAlgebraBases\n sage: L.<x, y> = LieAlgebra(QQ)\n sage: bases = FreeLieAlgebraBases(L)\n sage: bases.super_categories()\n [Category of Lie algebras with basis over Rational Field,\n Category of realizations of Free Lie algebra generated by (x, y) over Rational Field]\n '
return [LieAlgebras(self.base().base_ring()).WithBasis(), Realizations(self.base())]
|
def is_lyndon(w):
'\n Modified form of ``Word(w).is_lyndon()`` which uses the default order\n (this will either be the natural integer order or lex order) and assumes\n the input ``w`` behaves like a nonempty list.\n This function here is designed for speed.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.free_lie_algebra import is_lyndon\n sage: is_lyndon([1])\n True\n sage: is_lyndon([1,3,1])\n False\n sage: is_lyndon((2,2,3))\n True\n sage: all(is_lyndon(x) for x in LyndonWords(3, 5))\n True\n sage: all(is_lyndon(x) for x in LyndonWords(6, 4))\n True\n '
i = 0
for let in w[1:]:
if (w[i] < let):
i = 0
elif (w[i] == let):
i += 1
else:
return False
return (i == 0)
|
class HeisenbergAlgebra_abstract(IndexedGenerators):
'\n The common methods for the (non-matrix) Heisenberg algebras.\n '
def __init__(self, I):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo) # indirect doctest\n '
IndexedGenerators.__init__(self, I, prefix='', bracket=False, latex_bracket=False, string_quotes=False)
def p(self, i):
'\n The generator `p_i` of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.p(2)\n p2\n '
return self.element_class(self, {('p%i' % i): self.base_ring().one()})
def q(self, i):
'\n The generator `q_i` of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.q(2)\n q2\n '
return self.element_class(self, {('q%i' % i): self.base_ring().one()})
def z(self):
'\n Return the basis element `z` of the Heisenberg algebra.\n\n The element `z` spans the center of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.z()\n z\n '
return self.element_class(self, {'z': self.base_ring().one()})
def bracket_on_basis(self, x, y):
"\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n The basis of a Heisenberg algebra is ordered in such a way that\n the `p_i` come first, the `q_i` come next, and the `z` comes last.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 3)\n sage: p1 = ('p', 1)\n sage: q1 = ('q', 1)\n sage: H.bracket_on_basis(p1, q1)\n z\n "
if (y == 'z'):
return self.zero()
if ((x[0] == 'p') and (y[0] == 'q') and (x[1] == y[1])):
return self.z()
return self.zero()
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 3)\n sage: H._repr_term('p1')\n 'p1'\n sage: H._repr_term('z')\n 'z'\n "
return m
def _ascii_art_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 3)\n sage: H._ascii_art_term('p1')\n p1\n sage: H._ascii_art_term('z')\n z\n sage: ascii_art(sum(i * b for i, b in enumerate(H.basis())))\n p2 + 2*p3 + 3*q1 + 4*q2 + 5*q3 + 6*z\n "
from sage.typeset.ascii_art import ascii_art
return ascii_art(m)
def _latex_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 10)\n sage: H._latex_term('p1')\n 'p_{1}'\n sage: H._latex_term('z')\n 'z'\n sage: latex(H.p(10))\n p_{10}\n "
if (len(m) == 1):
return m
return ('%s_{%s}' % (m[0], m[1:]))
def _unicode_art_term(self, m):
"\n Return a unicode art representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 10)\n sage: H._unicode_art_term('p1')\n p₁\n sage: H._unicode_art_term('z')\n z\n sage: unicode_art(H.p(10))\n p₁₀\n "
from sage.typeset.unicode_art import unicode_art, unicode_subscript
if (len(m) == 1):
return unicode_art(m)
return unicode_art((str(m[0]) + unicode_subscript(m[1:])))
def step(self):
'\n Return the nilpotency step of ``self``.\n\n EXAMPLES::\n\n sage: h = lie_algebras.Heisenberg(ZZ, 10)\n sage: h.step()\n 2\n\n sage: h = lie_algebras.Heisenberg(ZZ, oo)\n sage: h.step()\n 2\n '
return Integer(2)
class Element(LieAlgebraElement):
pass
|
class HeisenbergAlgebra_fd():
'\n Common methods for finite-dimensional Heisenberg algebras.\n '
def __init__(self, n):
'\n Initialize ``self``.\n\n INPUT:\n\n - ``n`` -- the rank\n\n TESTS::\n\n sage: H = lie_algebras.Heisenberg(QQ, 3) # indirect doctest\n '
self._n = n
def n(self):
'\n Return the rank of the Heisenberg algebra ``self``.\n\n This is the ``n`` such that ``self`` is the `n`-th Heisenberg\n algebra. The dimension of this Heisenberg algebra is then\n `2n + 1`.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 3)\n sage: H.n()\n 3\n sage: H = lie_algebras.Heisenberg(QQ, 3, representation="matrix")\n sage: H.n()\n 3\n '
return self._n
@cached_method
def gens(self):
'\n Return the Lie algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 2)\n sage: H.gens()\n (p1, p2, q1, q2)\n sage: H = lie_algebras.Heisenberg(QQ, 0)\n sage: H.gens()\n (z,)\n '
return tuple(self.lie_algebra_generators())
def gen(self, i):
'\n Return the ``i``-th generator of ``self``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 2)\n sage: H.gen(0)\n p1\n sage: H.gen(3)\n q2\n '
return self.gens()[i]
@cached_method
def lie_algebra_generators(self):
"\n Return the Lie algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 1)\n sage: H.lie_algebra_generators()\n Finite family {'p1': p1, 'q1': q1}\n sage: H = lie_algebras.Heisenberg(QQ, 0)\n sage: H.lie_algebra_generators()\n Finite family {'z': z}\n "
if (self._n == 0):
return Family(['z'], (lambda i: self.z()))
k = [('p%s' % i) for i in range(1, (self._n + 1))]
k += [('q%s' % i) for i in range(1, (self._n + 1))]
d = {}
for i in range(1, (self._n + 1)):
d[('p%s' % i)] = self.p(i)
d[('q%s' % i)] = self.q(i)
return Family(k, (lambda i: d[i]))
@cached_method
def basis(self):
"\n Return the basis of ``self``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, 1)\n sage: H.basis()\n Finite family {'p1': p1, 'q1': q1, 'z': z}\n "
d = {}
for i in range(1, (self._n + 1)):
d[('p%s' % i)] = self.p(i)
d[('q%s' % i)] = self.q(i)
d['z'] = self.z()
return Family(self._indices, (lambda i: d[i]))
def _coerce_map_from_(self, H):
'\n Return the coercion map from ``H`` to ``self`` if one exists,\n otherwise return ``None``.\n\n EXAMPLES::\n\n sage: HB = lie_algebras.Heisenberg(QQ, 3)\n sage: HM = lie_algebras.Heisenberg(QQ, 3, representation="matrix")\n sage: HB.has_coerce_map_from(HM)\n True\n sage: HM.has_coerce_map_from(HB)\n True\n sage: HB(HM.p(2))\n p2\n sage: HM(-HB.q(3)) == -HM.q(3)\n True\n sage: HB(HM.z())\n z\n sage: HM(HB.z()) == HM.z()\n True\n sage: HQ = lie_algebras.Heisenberg(QQ, 2)\n sage: HB.has_coerce_map_from(HQ)\n True\n sage: HB(HQ.p(2))\n p2\n sage: HZ = lie_algebras.Heisenberg(ZZ, 2)\n sage: HB.has_coerce_map_from(HZ)\n True\n sage: HB(HZ.p(2))\n p2\n sage: HZ = lie_algebras.Heisenberg(ZZ, 2, representation="matrix")\n sage: HB.has_coerce_map_from(HZ)\n True\n sage: HB(HZ.p(2))\n p2\n '
if isinstance(H, HeisenbergAlgebra_fd):
if ((H._n <= self._n) and self.base_ring().has_coerce_map_from(H.base_ring())):
return H.module_morphism((lambda i: self.basis()[i]), codomain=self)
return None
return super()._coerce_map_from_(H)
|
class HeisenbergAlgebra(HeisenbergAlgebra_fd, HeisenbergAlgebra_abstract, LieAlgebraWithGenerators):
'\n A Heisenberg algebra defined using structure coefficients.\n\n The `n`-th Heisenberg algebra (where `n` is a nonnegative\n integer or infinity) is the Lie algebra with basis\n `\\{p_i\\}_{1 \\leq i \\leq n} \\cup \\{q_i\\}_{1 \\leq i \\leq n} \\cup \\{z\\}`\n with the following relations:\n\n .. MATH::\n\n [p_i, q_j] = \\delta_{ij} z, \\quad [p_i, z] = [q_i, z] = [p_i, p_j]\n = [q_i, q_j] = 0.\n\n This Lie algebra is also known as the Heisenberg algebra of rank `n`.\n\n .. NOTE::\n\n The relations `[p_i, q_j] = \\delta_{ij} z`, `[p_i, z] = 0`, and\n `[q_i, z] = 0` are known as canonical commutation relations. See\n :wikipedia:`Canonical_commutation_relations`.\n\n .. WARNING::\n\n The `n` in the above definition is called the "rank" of the\n Heisenberg algebra; it is not, however, a rank in any of the usual\n meanings that this word has in the theory of Lie algebras.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the rank of the Heisenberg algebra\n\n REFERENCES:\n\n - :wikipedia:`Heisenberg_algebra`\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 2)\n '
def __init__(self, R, n):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 2)\n sage: TestSuite(L).run()\n sage: L = lie_algebras.Heisenberg(QQ, 0) # not tested -- :trac:`18224`\n sage: TestSuite(L).run()\n '
HeisenbergAlgebra_fd.__init__(self, n)
names = tuple((([('p%s' % i) for i in range(1, (n + 1))] + [('q%s' % i) for i in range(1, (n + 1))]) + ['z']))
LieAlgebraWithGenerators.__init__(self, R, names=names, index_set=names, category=LieAlgebras(R).Nilpotent().FiniteDimensional().WithBasis())
HeisenbergAlgebra_abstract.__init__(self, names)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.Heisenberg(QQ, 3)\n Heisenberg algebra of rank 3 over Rational Field\n '
return 'Heisenberg algebra of rank {0} over {1}'.format(self._n, self.base_ring())
|
class InfiniteHeisenbergAlgebra(HeisenbergAlgebra_abstract, LieAlgebraWithGenerators):
'\n The infinite Heisenberg algebra.\n\n This is the Heisenberg algebra on an infinite number of generators. In\n other words, this is the Heisenberg algebra of rank `\\infty`. See\n :class:`HeisenbergAlgebra` for more information.\n '
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: TestSuite(L).run()\n sage: L.p(1).bracket(L.q(1)) == L.z()\n True\n sage: L.q(1).bracket(L.p(1)) == -L.z()\n True\n '
S = cartesian_product([PositiveIntegers(), ['p', 'q']])
cat = LieAlgebras(R).Nilpotent().WithBasis()
LieAlgebraWithGenerators.__init__(self, R, index_set=S, category=cat)
HeisenbergAlgebra_abstract.__init__(self, S)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.Heisenberg(QQ, oo)\n Infinite Heisenberg algebra over Rational Field\n '
return 'Infinite Heisenberg algebra over {}'.format(self.base_ring())
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L._an_element_()\n p2 + q2 - 1/2*q3 + z\n '
c = self.base_ring().an_element()
return (((self.p(2) + self.q(2)) - (c * self.q(3))) + self.z())
def lie_algebra_generators(self):
"\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.lie_algebra_generators()\n Lazy family (generator map(i))_{i in The Cartesian product of\n (Positive integers, {'p', 'q'})}\n "
return Family(self._indices, (lambda x: self.monomial((x[1] + str(x[0])))), name='generator map')
def basis(self):
"\n Return the basis of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.basis()\n Lazy family (basis map(i))_{i in Disjoint union of Family ({'z'},\n The Cartesian product of (Positive integers, {'p', 'q'}))}\n sage: L.basis()['z']\n z\n sage: L.basis()[(12, 'p')]\n p12\n "
S = cartesian_product([PositiveIntegers(), ['p', 'q']])
I = DisjointUnionEnumeratedSets([Set(['z']), S])
def basis_elt(x):
if isinstance(x, str):
return self.monomial(x)
return self.monomial((x[1] + str(x[0])))
return Family(I, basis_elt, name='basis map')
def _from_fd_on_basis(self, i):
"\n Return the monomial in ``self`` corresponding to the\n basis element indexed by ``i``, where ``i`` is a basis index for\n a *finite-dimensional* Heisenberg algebra.\n\n This is used for coercion.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, oo)\n sage: H._from_fd_on_basis('p2')\n p2\n sage: H._from_fd_on_basis('q3')\n q3\n sage: H._from_fd_on_basis('z')\n z\n "
if (i == 'z'):
return self.z()
if (i[0] == 'p'):
return self.p(Integer(i[1:]))
return self.q(Integer(i[1:]))
def _coerce_map_from_(self, H):
'\n Return the coercion map from ``H`` to ``self`` if one exists,\n otherwise return ``None``.\n\n EXAMPLES::\n\n sage: H = lie_algebras.Heisenberg(QQ, oo)\n sage: HZ = lie_algebras.Heisenberg(ZZ, oo)\n sage: phi = H.coerce_map_from(HZ)\n sage: phi(HZ.p(3)) == H.p(3)\n True\n sage: phi(HZ.p(3)).leading_coefficient().parent()\n Rational Field\n sage: HF = lie_algebras.Heisenberg(QQ, 3, representation="matrix")\n sage: H.has_coerce_map_from(HF)\n True\n sage: H(HF.p(2))\n p2\n sage: H(HF.z())\n z\n sage: HF = lie_algebras.Heisenberg(QQ, 3)\n sage: H.has_coerce_map_from(HF)\n True\n sage: H(HF.p(2))\n p2\n sage: H(HF.z())\n z\n '
if isinstance(H, HeisenbergAlgebra_fd):
if self.base_ring().has_coerce_map_from(H.base_ring()):
return H.module_morphism(self._from_fd_on_basis, codomain=self)
return None
if isinstance(H, InfiniteHeisenbergAlgebra):
if self.base_ring().has_coerce_map_from(H.base_ring()):
return (lambda C, x: self._from_dict(x._monomial_coefficients, coerce=True))
return None
return super()._coerce_map_from_(H)
|
class HeisenbergAlgebra_matrix(HeisenbergAlgebra_fd, LieAlgebraFromAssociative):
'\n A Heisenberg algebra represented using matrices.\n\n The `n`-th Heisenberg algebra over `R` is a Lie algebra which is\n defined as the Lie algebra of the `(n+2) \\times (n+2)`-matrices:\n\n .. MATH::\n\n \\begin{bmatrix}\n 0 & p^T & k \\\\\n 0 & 0_n & q \\\\\n 0 & 0 & 0\n \\end{bmatrix}\n\n where `p, q \\in R^n` and `0_n` in the `n \\times n` zero matrix. It has\n a basis consisting of\n\n .. MATH::\n\n \\begin{aligned}\n p_i & = \\begin{bmatrix}\n 0 & e_i^T & 0 \\\\\n 0 & 0_n & 0 \\\\\n 0 & 0 & 0\n \\end{bmatrix} \\qquad \\text{for } 1 \\leq i \\leq n ,\n \\\\ q_i & = \\begin{bmatrix}\n 0 & 0 & 0 \\\\\n 0 & 0_n & e_i \\\\\n 0 & 0 & 0\n \\end{bmatrix} \\qquad \\text{for } 1 \\leq i \\leq n ,\n \\\\ z & = \\begin{bmatrix}\n 0 & 0 & 1 \\\\\n 0 & 0_n & 0 \\\\\n 0 & 0 & 0\n \\end{bmatrix},\n \\end{aligned}\n\n where `\\{e_i\\}` is the standard basis of `R^n`. In other words, it has\n the basis `(p_1, p_2, \\ldots, p_n, q_1, q_2, \\ldots, q_n, z)`, where\n `p_i = E_{1, i+1}`, `q_i = E_{i+1, n+2}` and `z = E_{1, n+2}` are\n elementary matrices.\n\n This Lie algebra is isomorphic to the `n`-th Heisenberg algebra\n constructed in :class:`HeisenbergAlgebra`; the bases correspond to\n each other.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``n`` -- the nonnegative integer `n`\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1, representation="matrix")\n sage: p = L.p(1)\n sage: q = L.q(1)\n sage: z = L.bracket(p, q); z\n [0 0 1]\n [0 0 0]\n [0 0 0]\n sage: z == L.z()\n True\n sage: L.dimension()\n 3\n\n sage: L = lie_algebras.Heisenberg(QQ, 2, representation="matrix")\n sage: sorted(dict(L.basis()).items())\n [(\n [0 1 0 0]\n [0 0 0 0]\n [0 0 0 0]\n \'p1\', [0 0 0 0]\n ),\n (\n [0 0 1 0]\n [0 0 0 0]\n [0 0 0 0]\n \'p2\', [0 0 0 0]\n ),\n (\n [0 0 0 0]\n [0 0 0 1]\n [0 0 0 0]\n \'q1\', [0 0 0 0]\n ),\n (\n [0 0 0 0]\n [0 0 0 0]\n [0 0 0 1]\n \'q2\', [0 0 0 0]\n ),\n (\n [0 0 0 1]\n [0 0 0 0]\n [0 0 0 0]\n \'z\', [0 0 0 0]\n )]\n\n sage: L = lie_algebras.Heisenberg(QQ, 0, representation="matrix")\n sage: sorted(dict(L.basis()).items())\n [(\n [0 1]\n \'z\', [0 0]\n )]\n sage: L.gens()\n (\n [0 1]\n [0 0]\n )\n sage: L.lie_algebra_generators()\n Finite family {\'z\': [0 1]\n [0 0]}\n '
def __init__(self, R, n):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 2, representation="matrix")\n sage: TestSuite(L).run()\n '
HeisenbergAlgebra_fd.__init__(self, n)
MS = MatrixSpace(R, (n + 2), sparse=True)
one = R.one()
p = tuple((MS({(0, i): one}) for i in range(1, (n + 1))))
q = tuple((MS({(i, (n + 1)): one}) for i in range(1, (n + 1))))
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).Nilpotent().FiniteDimensional().WithBasis()
LieAlgebraFromAssociative.__init__(self, MS, ((p + q) + z), names=names, index_set=names, category=cat)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.Heisenberg(QQ, 3, representation="matrix")\n Heisenberg algebra of rank 3 over Rational Field\n '
return 'Heisenberg algebra of rank {} over {}'.format(self._n, self.base_ring())
def p(self, i):
'\n Return the generator `p_i` of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1, representation="matrix")\n sage: L.p(1)\n [0 1 0]\n [0 0 0]\n [0 0 0]\n '
return self._gens[('p%s' % i)]
def q(self, i):
'\n Return the generator `q_i` of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1, representation="matrix")\n sage: L.q(1)\n [0 0 0]\n [0 0 1]\n [0 0 0]\n '
return self._gens[('q%s' % i)]
def z(self):
'\n Return the basis element `z` of the Heisenberg algebra.\n\n The element `z` spans the center of the Heisenberg algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1, representation="matrix")\n sage: L.z()\n [0 0 1]\n [0 0 0]\n [0 0 0]\n '
return self._gens['z']
def step(self):
'\n Return the nilpotency step of ``self``.\n\n EXAMPLES::\n\n sage: h = lie_algebras.Heisenberg(ZZ, 2, representation="matrix")\n sage: h.step()\n 2\n '
return Integer(2)
class Element(LieAlgebraMatrixWrapper, LieAlgebraFromAssociative.Element):
def monomial_coefficients(self, copy=True):
'\n Return a dictionary whose keys are indices of basis elements in\n the support of ``self`` and whose values are the corresponding\n coefficients.\n\n INPUT:\n\n - ``copy`` -- ignored\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 3, representation="matrix")\n sage: elt = L(Matrix(QQ, [[0, 1, 3, 0, 3], [0, 0, 0, 0, 0], [0, 0, 0, 0, -3],\n ....: [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]]))\n sage: elt\n [ 0 1 3 0 3]\n [ 0 0 0 0 0]\n [ 0 0 0 0 -3]\n [ 0 0 0 0 7]\n [ 0 0 0 0 0]\n sage: sorted(elt.monomial_coefficients().items())\n [(\'p1\', 1), (\'p2\', 3), (\'q2\', -3), (\'q3\', 7), (\'z\', 3)]\n '
d = {}
n = self.parent()._n
for (i, mon) in enumerate(self.parent().basis().keys()):
if (i < n):
entry = self[(0, (i + 1))]
elif (i < (2 * n)):
entry = self[(((i - n) + 1), (n + 1))]
else:
entry = self[(0, (n + 1))]
if entry:
d[mon] = entry
return d
|
class LieAlgebra(Parent, UniqueRepresentation):
'\n A Lie algebra `L` over a base ring `R`.\n\n A Lie algebra is an `R`-module `L` with a bilinear operation called\n Lie bracket `[\\cdot, \\cdot] : L \\times L \\to L` such that\n `[x, x] = 0` and the following relation holds:\n\n .. MATH::\n\n \\bigl[ x, [y, z] \\bigr] + \\bigl[ y, [z, x] \\bigr]\n + \\bigl[ z, [x, y] \\bigr] = 0.\n\n This relation is known as the *Jacobi identity* (or sometimes the Jacobi\n relation). We note that from `[x, x] = 0`, we have `[x + y, x + y] = 0`.\n Next from bilinearity, we see that\n\n .. MATH::\n\n 0 = [x + y, x + y] = [x, x] + [x, y] + [y, x] + [y, y]\n = [x, y] + [y, x],\n\n thus `[x, y] = -[y, x]` and the Lie bracket is antisymmetric.\n\n Lie algebras are closely related to Lie groups. Let `G` be a Lie group\n and fix some `g \\in G`. We can construct the Lie algebra `L` of `G` by\n considering the tangent space at `g`. We can also (partially) recover `G`\n from `L` by using what is known as the exponential map.\n\n Given any associative algebra `A`, we can construct a Lie algebra `L`\n on the `R`-module `A` by defining the Lie bracket to be the commutator\n `[a, b] = ab - ba`. We call an associative algebra `A` which contains\n `L` in this fashion an *enveloping algebra* of `L`. The embedding\n `L \\to A` which sends the Lie bracket to the commutator will be called\n a Lie embedding. Now if we are given a Lie algebra `L`, we\n can construct an enveloping algebra `U_L` with Lie embedding `h : L \\to\n U_L` which has the following universal property: for any enveloping\n algebra `A` with Lie embedding `f : L \\to A`, there exists a unique unital\n algebra homomorphism `g : U_L \\to A` such that `f = g \\circ h`. The\n algebra `U_L` is known as the *universal enveloping algebra* of `L`.\n\n INPUT:\n\n See examples below for various input options.\n\n EXAMPLES:\n\n **1.** The simplest examples of Lie algebras are *abelian Lie\n algebras*. These are Lie algebras whose Lie bracket is (identically)\n zero. We can create them using the ``abelian`` keyword::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, abelian=True); L\n Abelian Lie algebra on 3 generators (x, y, z) over Rational Field\n\n **2.** A Lie algebra can be built from any associative algebra by\n defining the Lie bracket to be the commutator. For example, we can\n start with the descent algebra::\n\n sage: D = DescentAlgebra(QQ, 4).D()\n sage: L = LieAlgebra(associative=D); L\n Lie algebra of Descent algebra of 4 over Rational Field\n in the standard basis\n sage: L(D[2]).bracket(L(D[3]))\n D{1, 2} - D{1, 3} + D{2} - D{3}\n\n Next we use a free algebra and do some simple computations::\n\n sage: R.<a,b,c> = FreeAlgebra(QQ, 3)\n sage: L.<x,y,z> = LieAlgebra(associative=R.gens())\n sage: x-y+z\n a - b + c\n sage: L.bracket(x-y, x-z)\n a*b - a*c - b*a + b*c + c*a - c*b\n sage: L.bracket(x-y, L.bracket(x,y))\n a^2*b - 2*a*b*a + a*b^2 + b*a^2 - 2*b*a*b + b^2*a\n\n We can also use a subset of the elements as a generating set\n of the Lie algebra::\n\n sage: R.<a,b,c> = FreeAlgebra(QQ, 3)\n sage: L.<x,y> = LieAlgebra(associative=[a,b+c])\n sage: L.bracket(x, y)\n a*b + a*c - b*a - c*a\n\n Now for a more complicated example using the group ring of `S_3` as our\n base algebra::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L.<x,y> = LieAlgebra(associative=S.gens())\n sage: L.bracket(x, y)\n (2,3) - (1,3)\n sage: L.bracket(x, y-x)\n (2,3) - (1,3)\n sage: L.bracket(L.bracket(x, y), y)\n 2*(1,2,3) - 2*(1,3,2)\n sage: L.bracket(x, L.bracket(x, y))\n (2,3) - 2*(1,2) + (1,3)\n sage: L.bracket(x, L.bracket(L.bracket(x, y), y))\n 0\n\n Here is an example using matrices::\n\n sage: MS = MatrixSpace(QQ,2)\n sage: m1 = MS([[0, -1], [1, 0]])\n sage: m2 = MS([[-1, 4], [3, 2]])\n sage: L.<x,y> = LieAlgebra(associative=[m1, m2])\n sage: x\n [ 0 -1]\n [ 1 0]\n sage: y\n [-1 4]\n [ 3 2]\n sage: L.bracket(x,y)\n [-7 -3]\n [-3 7]\n sage: L.bracket(y,y)\n [0 0]\n [0 0]\n sage: L.bracket(y,x)\n [ 7 3]\n [ 3 -7]\n sage: L.bracket(x, L.bracket(y,x))\n [-6 14]\n [14 6]\n\n (See :class:`LieAlgebraFromAssociative` for other examples.)\n\n **3.** We can also creating a Lie algebra by inputting a set of\n structure coefficients. For example, we can create the Lie algebra\n of `\\QQ^3` under the Lie bracket `\\times` (cross-product)::\n\n sage: d = {(\'x\',\'y\'): {\'z\':1}, (\'y\',\'z\'): {\'x\':1}, (\'z\',\'x\'): {\'y\':1}}\n sage: L.<x,y,z> = LieAlgebra(QQ, d)\n sage: L\n Lie algebra on 3 generators (x, y, z) over Rational Field\n\n To compute the Lie bracket of two elements, you cannot use the ``*``\n operator. Indeed, this automatically lifts up to the universal\n enveloping algebra and takes the (associative) product there.\n To get elements in the Lie algebra, you must use :meth:`bracket`::\n\n sage: L = LieAlgebra(QQ, {(\'e\',\'h\'): {\'e\':-2}, (\'f\',\'h\'): {\'f\':2},\n ....: (\'e\',\'f\'): {\'h\':1}}, names=\'e,f,h\')\n sage: e,f,h = L.lie_algebra_generators()\n sage: L.bracket(h, e)\n 2*e\n sage: elt = h*e; elt\n e*h + 2*e\n sage: P = elt.parent(); P\n Noncommutative Multivariate Polynomial Ring in e, f, h over Rational Field,\n nc-relations: {...}\n sage: R = P.relations()\n sage: for rhs in sorted(R, key=str): print("{} = {}".format(rhs, R[rhs]))\n f*e = e*f - h\n h*e = e*h + 2*e\n h*f = f*h - 2*f\n\n For convenience, there are two shorthand notations for computing\n Lie brackets::\n\n sage: L([h,e])\n 2*e\n sage: L([h,[e,f]])\n 0\n sage: L([[h,e],[e,f]])\n -4*e\n sage: L[h, e]\n 2*e\n sage: L[h, L[e, f]]\n 0\n\n .. WARNING::\n\n Because this is a modified (abused) version of python syntax, it\n does **NOT** work with addition. For example ``L([e + [h, f], h])``\n and ``L[e + [h, f], h]`` will both raise errors. Instead you must\n use ``L[e + L[h, f], h]``.\n\n **4.** We can construct a Lie algebra from a Cartan type by using\n the ``cartan_type`` option::\n\n sage: L = LieAlgebra(ZZ, cartan_type=[\'C\', 3])\n sage: L.inject_variables()\n Defining e1, e2, e3, f1, f2, f3, h1, h2, h3\n sage: e1.bracket(e2)\n -E[alpha[1] + alpha[2]]\n sage: L([[e1, e2], e2])\n 0\n sage: L([[e2, e3], e3])\n 0\n sage: L([e2, [e2, e3]])\n 2*E[2*alpha[2] + alpha[3]]\n\n sage: L = LieAlgebra(ZZ, cartan_type=[\'E\', 6])\n sage: L\n Lie algebra of [\'E\', 6] in the Chevalley basis\n\n When the Cartan type is finite type and simply-laced, we can also\n specify an asymmetry function from [Ka1990]_ using a Dynkin diagram\n orientation with the ``epsilon`` option::\n\n sage: L = LieAlgebra(QQ, cartan_type=[\'A\', 2], epsilon=[(1, 2)])\n sage: e1, e2 = L.e()\n sage: L[e1, e2]\n -E[alpha[1] + alpha[2]]\n\n sage: L = LieAlgebra(QQ, cartan_type=[\'A\', 2], epsilon=[(2, 1)])\n sage: e1, e2 = L.e()\n sage: L[e1, e2]\n E[alpha[1] + alpha[2]]\n\n We also have matrix versions of the classical Lie algebras::\n\n sage: L = LieAlgebra(ZZ, cartan_type=[\'A\', 2], representation=\'matrix\')\n sage: L.gens()\n (\n [0 1 0] [0 0 0] [0 0 0] [0 0 0] [ 1 0 0] [ 0 0 0]\n [0 0 0] [0 0 1] [1 0 0] [0 0 0] [ 0 -1 0] [ 0 1 0]\n [0 0 0], [0 0 0], [0 0 0], [0 1 0], [ 0 0 0], [ 0 0 -1]\n )\n\n There is also the compact real form of matrix Lie algebras\n implemented (the base ring must currently be a field)::\n\n sage: L = LieAlgebra(QQ, cartan_type=[\'A\', 2], representation="compact real")\n sage: list(L.basis())\n [\n [ 0 1 0] [ 0 0 1] [ 0 0 0] [ i 0 0] [0 i 0] [0 0 i]\n [-1 0 0] [ 0 0 0] [ 0 0 1] [ 0 0 0] [i 0 0] [0 0 0]\n [ 0 0 0], [-1 0 0], [ 0 -1 0], [ 0 0 -i], [0 0 0], [i 0 0],\n <BLANKLINE>\n [ 0 0 0] [0 0 0]\n [ 0 i 0] [0 0 i]\n [ 0 0 -i], [0 i 0]\n ]\n\n **5.** We construct a free Lie algebra in a few different ways. There are\n two primary representations, as brackets and as polynomials::\n\n sage: L = LieAlgebra(QQ, \'x,y,z\'); L\n Free Lie algebra generated by (x, y, z) over Rational Field\n sage: P.<a,b,c> = LieAlgebra(QQ, representation="polynomial"); P\n Lie algebra generated by (a, b, c) in\n Free Algebra on 3 generators (a, b, c) over Rational Field\n\n This has the basis given by Hall and the one indexed by Lyndon words.\n We do some computations and convert between the bases::\n\n sage: H = L.Hall()\n doctest:warning...:\n FutureWarning: The Hall basis has not been fully proven correct, but currently no bugs are known\n See https://github.com/sagemath/sage/issues/16823 for details.\n sage: H\n Free Lie algebra generated by (x, y, z) over Rational Field in the Hall basis\n sage: Lyn = L.Lyndon()\n sage: Lyn\n Free Lie algebra generated by (x, y, z) over Rational Field in the Lyndon basis\n sage: x,y,z = Lyn.lie_algebra_generators()\n sage: a = Lyn([x, [[z, [x, y]], [y, x]]]); a\n -[x, [[x, y], [x, [y, z]]]] - [x, [[x, y], [[x, z], y]]]\n sage: H(a)\n [[x, y], [z, [x, [x, y]]]] - [[x, y], [[x, y], [x, z]]]\n + [[x, [x, y]], [z, [x, y]]]\n\n We also have the free Lie algebra given in the polynomial\n representation, which is the canonical embedding of the free\n Lie algebra into the free algebra (i.e., the ring of\n noncommutative polynomials).\n So the generators of the free Lie algebra are the generators of the\n free algebra and the Lie bracket is the commutator::\n\n sage: P.<a,b,c> = LieAlgebra(QQ, representation="polynomial"); P\n Lie algebra generated by (a, b, c) in\n Free Algebra on 3 generators (a, b, c) over Rational Field\n sage: P.bracket(a, b) + P.bracket(a - c, b + 3*c)\n 2*a*b + 3*a*c - 2*b*a + b*c - 3*c*a - c*b\n\n **6.** Nilpotent Lie algebras are Lie algebras such that there exists an\n integer `s` such that all iterated brackets of length longer than `s`\n are zero. They can be constructed from structural coefficients using the\n ``nilpotent`` keyword::\n\n sage: L.<X,Y,Z> = LieAlgebra(QQ, {(\'X\',\'Y\'): {\'Z\': 1}}, nilpotent=True)\n sage: L\n Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field\n sage: L.category()\n Category of finite dimensional nilpotent Lie algebras with basis over Rational Field\n\n A second example defining the Engel Lie algebra::\n\n sage: sc = {(\'X\',\'Y\'): {\'Z\': 1}, (\'X\',\'Z\'): {\'W\': 1}}\n sage: E.<X,Y,Z,W> = LieAlgebra(QQ, sc, nilpotent=True); E\n Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: E.step()\n 3\n sage: E[X, Y + Z]\n Z + W\n sage: E[X, [X, Y + Z]]\n W\n sage: E[X, [X, [X, Y + Z]]]\n 0\n\n A nilpotent Lie algebra will also be constructed if given a ``category``\n of a nilpotent Lie algebra::\n\n sage: C = LieAlgebras(QQ).Nilpotent().FiniteDimensional().WithBasis()\n sage: L.<X,Y,Z> = LieAlgebra(QQ, {(\'X\',\'Y\'): {\'Z\': 1}}, category=C); L\n Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field\n\n **7.** Free nilpotent Lie algebras are the truncated versions of the free\n Lie algebras. That is, the only relations other than anticommutativity\n and the Jacobi identity among the Lie brackets are that brackets of\n length higher than the nilpotency step vanish. They can be created by\n using the ``step`` keyword::\n\n sage: L = LieAlgebra(ZZ, 2, step=3); L\n Free Nilpotent Lie algebra on 5 generators (X_1, X_2, X_12, X_112, X_122) over Integer Ring\n sage: L.step()\n 3\n\n REFERENCES:\n\n - [deG2000]_ Willem A. de Graaf. *Lie Algebras: Theory and Algorithms*.\n - [Ka1990]_ Victor Kac, *Infinite dimensional Lie algebras*.\n - :wikipedia:`Lie_algebra`\n '
@staticmethod
def __classcall_private__(cls, R=None, arg0=None, arg1=None, names=None, index_set=None, abelian=False, nilpotent=False, category=None, **kwds):
"\n Select the correct parent based upon input.\n\n TESTS::\n\n sage: LieAlgebra(QQ, abelian=True, names='x,y,z')\n Abelian Lie algebra on 3 generators (x, y, z) over Rational Field\n sage: LieAlgebra(QQ, {('e','h'): {'e':-2}, ('f','h'): {'f':2},\n ....: ('e','f'): {'h':1}}, names='e,f,h')\n Lie algebra on 3 generators (e, f, h) over Rational Field\n "
assoc = kwds.get('associative', None)
if (assoc is not None):
return LieAlgebraFromAssociative(assoc, names=names, index_set=index_set, category=category)
ct = kwds.pop('cartan_type', None)
if (ct is not None):
from sage.combinat.root_system.cartan_type import CartanType
ct = CartanType(ct)
if ct.is_affine():
from sage.algebras.lie_algebras.affine_lie_algebra import AffineLieAlgebra
return AffineLieAlgebra(R, cartan_type=ct, kac_moody=kwds.get('kac_moody', True))
if (not ct.is_finite()):
raise NotImplementedError('non-finite types are not implemented yet, see trac #14901 for details')
rep = kwds.pop('representation', 'bracket')
if (rep == 'bracket'):
from sage.algebras.lie_algebras.classical_lie_algebra import LieAlgebraChevalleyBasis
return LieAlgebraChevalleyBasis(R, ct, **kwds)
if (rep == 'matrix'):
from sage.algebras.lie_algebras.classical_lie_algebra import ClassicalMatrixLieAlgebra
return ClassicalMatrixLieAlgebra(R, ct, **kwds)
if (rep == 'compact real'):
from sage.algebras.lie_algebras.classical_lie_algebra import MatrixCompactRealForm
return MatrixCompactRealForm(R, ct, **kwds)
raise ValueError('invalid representation')
if (R is None):
raise ValueError('invalid arguments')
def check_assoc(A):
return (isinstance(A, (Ring, MatrixSpace)) or (A in Rings()) or (A in Algebras(R).Associative()))
if ((arg0 in ZZ) or check_assoc(arg1)):
(arg0, arg1) = (arg1, arg0)
if isinstance(arg0, dict):
if (not arg0):
from sage.algebras.lie_algebras.abelian import AbelianLieAlgebra
return AbelianLieAlgebra(R, names, index_set)
elif isinstance(next(iter(arg0.keys())), (list, tuple)):
(arg1, arg0) = (arg0, arg1)
if isinstance(arg0, (list, tuple)):
if all((isinstance(x, str) for x in arg0)):
names = tuple(arg0)
if isinstance(arg0, str):
names = tuple(arg0.split(','))
elif isinstance(names, str):
names = tuple(names.split(','))
if isinstance(arg1, dict):
if (nilpotent or ((category is not None) and category.is_subcategory(LieAlgebras(R).Nilpotent()))):
from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense
return NilpotentLieAlgebra_dense(R, arg1, names, index_set, category=category, **kwds)
from sage.algebras.lie_algebras.structure_coefficients import LieAlgebraWithStructureCoefficients
return LieAlgebraWithStructureCoefficients(R, arg1, names, index_set, category=category, **kwds)
if (arg1 in ZZ):
step = kwds.get('step', None)
if step:
from sage.algebras.lie_algebras.nilpotent_lie_algebra import FreeNilpotentLieAlgebra
del kwds['step']
return FreeNilpotentLieAlgebra(R, arg1, step, names=names, **kwds)
elif nilpotent:
raise ValueError("free nilpotent Lie algebras must have a 'step' parameter given")
if isinstance(arg0, str):
names = arg0
if (names is None):
index_set = list(range(arg1))
else:
if isinstance(names, str):
names = tuple(names.split(','))
if ((arg1 != 1) and (len(names) == 1)):
names = tuple(('{}{}'.format(names[0], i) for i in range(arg1)))
if (arg1 != len(names)):
raise ValueError('the number of names must equal the number of generators')
if (('step' in kwds) or nilpotent):
raise ValueError('free nilpotent Lie algebras must have both a number of generators and step parameters specified')
if abelian:
from sage.algebras.lie_algebras.abelian import AbelianLieAlgebra
return AbelianLieAlgebra(R, names, index_set)
rep = kwds.get('representation', 'bracket')
if (rep == 'polynomial'):
from sage.algebras.free_algebra import FreeAlgebra
F = FreeAlgebra(R, names)
if (index_set is None):
index_set = F.variable_names()
return LieAlgebraFromAssociative(F, F.gens(), names=names, index_set=index_set)
from sage.algebras.lie_algebras.free_lie_algebra import FreeLieAlgebra
return FreeLieAlgebra(R, names, index_set)
def __init__(self, R, names=None, category=None):
'\n The Lie algebra.\n\n INPUT:\n\n - ``R`` -- the base ring\n\n - ``names`` -- (optional) the names of the generators\n\n - ``category`` -- the category of the Lie algebra; the default is the\n category of Lie algebras over ``R``\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.category()\n Category of finite dimensional nilpotent Lie algebras with basis over Rational Field\n '
category = LieAlgebras(R).or_subcategory(category)
Parent.__init__(self, base=R, names=names, category=category)
def _element_constructor_(self, x):
'\n Convert ``x`` into ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, representation="polynomial")\n sage: elt = L([x, y]); elt\n x*y - y*x\n sage: elt.parent() is L\n True\n\n TESTS:\n\n Check that `0` gives the zero element::\n\n sage: L = lie_algebras.pwitt(GF(5), 5)\n sage: L(0)\n 0\n '
if (isinstance(x, list) and (len(x) == 2)):
return self(x[0])._bracket_(self(x[1]))
if (x == 0):
return self.zero()
try:
if (x in self.module()):
return self.from_vector(x)
except AttributeError:
pass
if (x in self.base_ring()):
raise ValueError('can only convert the scalar 0 into a Lie algebra element')
return self.element_class(self, x)
def __getitem__(self, x):
'\n If ``x`` is a pair `(a, b)`, return the Lie bracket `[a, b]\n (including if `a` or `b` are Lie (sub)algebras, in which case the\n corresponding ideal is constructed).\n Otherwise try to return the `x`-th element of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, representation="polynomial")\n sage: L[x, [y, x]]\n -x^2*y + 2*x*y*x - y*x^2\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L[L, L]\n Ideal () of Abelian Lie algebra on 2 generators (x, y) over Rational Field\n\n sage: L = lie_algebras.Heisenberg(QQ, 1)\n sage: Z = L[L, L]; Z\n Ideal (z) of Heisenberg algebra of rank 1 over Rational Field\n sage: L[Z, L]\n Ideal () of Heisenberg algebra of rank 1 over Rational Field\n\n sage: p,q,z = L.basis(); (p, q, z)\n (p1, q1, z)\n sage: L[p, L]\n Ideal (p1) of Heisenberg algebra of rank 1 over Rational Field\n sage: L[L, p+q]\n Ideal (p1 + q1) of Heisenberg algebra of rank 1 over Rational Field\n '
if (isinstance(x, tuple) and (len(x) == 2)):
if (x[0] in LieAlgebras):
if (x[1] in LieAlgebras):
return x[0].product_space(x[1])
return x[0].ideal(x[1])
elif (x[1] in LieAlgebras):
return x[1].ideal(x[0])
return self(x[0])._bracket_(self(x[1]))
return super().__getitem__(x)
def _coerce_map_from_(self, R):
'\n Return ``True`` if there is a coercion from ``R`` into ``self`` and\n ``False`` otherwise.\n\n The things that coerce into ``self`` are:\n\n - Lie algebras in the same variables over a base with a coercion\n map into ``self.base_ring()``.\n\n - A module which coerces into the base vector space of ``self``.\n\n TESTS::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L._coerce_map_from_(L.module())\n True\n sage: L._coerce_map_from_(FreeModule(ZZ, 2))\n True\n '
if (not isinstance(R, LieAlgebra)):
if (self.module is not NotImplemented):
return self.module().has_coerce_map_from(R)
return False
if (R._indices != self._indices):
return False
return self.base_ring().has_coerce_map_from(R.base_ring())
def _Hom_(self, Y, category):
'\n Return the homset from ``self`` to ``Y`` in the category ``category``.\n\n INPUT:\n\n - ``Y`` -- a Lie algebra\n - ``category`` -- a subcategory of :class:`LieAlgebras` or ``None``\n\n The sole purpose of this method is to construct the homset\n as a :class:`~sage.algebras.lie_algebras.morphism.LieAlgebraHomset`.\n\n This method is not meant to be called directly. Please use\n :func:`sage.categories.homset.Hom` instead.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ)\n sage: H = L.Hall()\n sage: Hom(H, H)\n Set of Lie algebra morphisms from\n Free Lie algebra generated by (x, y) over Rational Field in the Hall basis\n to Free Lie algebra generated by (x, y) over Rational Field in the Hall basis\n '
cat = LieAlgebras(self.base_ring())
if ((category is not None) and (not category.is_subcategory(cat))):
raise TypeError(f'{category} is not a subcategory of Lie algebras')
if (Y not in cat):
raise TypeError(f'{Y} is not a Lie algebra')
from sage.algebras.lie_algebras.morphism import LieAlgebraHomset
return LieAlgebraHomset(self, Y, category=category)
@cached_method
def zero(self):
'\n Return the element `0`.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, representation="polynomial")\n sage: L.zero()\n 0\n '
return self.element_class(self, {})
def _from_dict(self, d, coerce=False, remove_zeros=True):
"\n Construct an element of ``self`` from an ``{index: coefficient}``\n dictionary.\n\n INPUT:\n\n - ``d`` -- a dictionary ``{index: coeff}`` where each ``index`` is the\n index of a basis element and each ``coeff`` belongs to the\n coefficient ring ``self.base_ring()``\n\n - ``coerce`` -- a boolean (default: ``False``), whether to coerce the\n ``coeff`` to the coefficient ring\n\n - ``remove_zeros`` -- a boolean (default: ``True``), if some\n ``coeff`` may be zero and should therefore be removed\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: d = {'p1': 4, 'q3': 1/2, 'z': -2}\n sage: L._from_dict(d)\n 4*p1 + 1/2*q3 - 2*z\n "
assert isinstance(d, dict)
if coerce:
R = self.base_ring()
d = {key: R(coeff) for (key, coeff) in d.items()}
if remove_zeros:
d = {key: coeff for (key, coeff) in d.items() if coeff}
return self.element_class(self, d)
def monomial(self, i):
"\n Return the monomial indexed by ``i``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.monomial('p1')\n p1\n "
return self.element_class(self, {i: self.base_ring().one()})
def term(self, i, c=None):
"\n Return the term indexed by ``i`` with coefficient ``c``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L.term('p1', 4)\n 4*p1\n "
if (c is None):
c = self.base_ring().one()
else:
c = self.base_ring()(c)
return self.element_class(self, {i: c})
def get_order(self):
"\n Return an ordering of the basis indices.\n\n .. TODO::\n\n Remove this method and in :class:`CombinatorialFreeModule`\n in favor of a method in the category of (finite dimensional)\n modules with basis.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {})\n sage: L.get_order()\n ('x', 'y')\n "
try:
return self._basis_ordering
except AttributeError:
raise ValueError('the Lie algebra is not finite dimensional with a basis')
|
class LieAlgebraWithGenerators(LieAlgebra):
'\n A Lie algebra with distinguished generators.\n '
def __init__(self, R, names=None, index_set=None, category=None, prefix='L', **kwds):
'\n The Lie algebra.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``names`` -- (optional) the names of the generators\n - ``index_set`` -- (optional) the indexing set\n - ``category`` -- the category of the Lie algebra; the default is the\n category of Lie algebras over ``R``\n - ``prefix`` -- (optional) the prefix for the generator representation\n - any keyword accepted by\n :class:`~sage.structure.indexed_generators.IndexedGenerators`\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.category()\n Category of finite dimensional nilpotent Lie algebras with basis over Rational Field\n '
self._indices = index_set
LieAlgebra.__init__(self, R, names, category)
@cached_method
def lie_algebra_generators(self):
'\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, representation="polynomial")\n sage: L.lie_algebra_generators()\n Finite family {\'x\': x, \'y\': y}\n '
return Family(self._indices, self.monomial, name='monomial map')
@cached_method
def gens(self):
'\n Return a tuple whose entries are the generators for this\n object, in some order.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.gens()\n (x, y)\n '
G = self.lie_algebra_generators()
try:
return tuple((G[i] for i in self.variable_names()))
except (KeyError, IndexError):
return tuple((G[i] for i in self.indices()))
except ValueError:
return tuple(G)
def gen(self, i):
'\n Return the ``i``-th generator of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.gen(0)\n x\n '
return self.gens()[i]
def indices(self):
'\n Return the indices of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, representation="polynomial")\n sage: L.indices()\n {\'x\', \'y\'}\n '
return self._indices
|
class FinitelyGeneratedLieAlgebra(LieAlgebraWithGenerators):
'\n A finitely generated Lie algebra.\n '
def __init__(self, R, names=None, index_set=None, category=None):
'\n Initialize ``self``.\n\n INPUT:\n\n - ``R`` -- the base ring\n\n - ``names`` -- the names of the generators\n\n - ``index_set`` -- the index set of the generators\n\n - ``category`` -- the category of the Lie algebra\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.category()\n Category of finite dimensional nilpotent Lie algebras with basis over Rational Field\n '
LieAlgebraWithGenerators.__init__(self, R, names, index_set, category)
self.__ngens = len(self._indices)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: F.<x,y> = LieAlgebra(QQ, {('x','y'): {'x': 1}})\n sage: F\n Lie algebra on 2 generators (x, y) over Rational Field\n "
if (self.__ngens == 1):
return 'Lie algebra on the generator {0} over {1}'.format(self.gen(0), self.base_ring())
return 'Lie algebra on {0} generators {1} over {2}'.format(self.__ngens, self.gens(), self.base_ring())
@lazy_attribute
def _ordered_indices(self):
"\n Return the index set of the basis of ``self`` in (some) order.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L._ordered_indices\n ('x', 'y')\n "
return tuple(self.basis().keys())
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: L.an_element()\n x + y\n '
return self.sum(self.lie_algebra_generators())
|
class InfinitelyGeneratedLieAlgebra(LieAlgebraWithGenerators):
'\n An infinitely generated Lie algebra.\n '
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, oo)\n sage: L._an_element_()\n p2 + q2 - 1/2*q3 + z\n '
return self.lie_algebra_generators()[self._indices.an_element()]
|
class LieAlgebraFromAssociative(LieAlgebraWithGenerators):
'\n A Lie algebra whose elements are from an associative algebra and whose\n bracket is the commutator.\n\n .. TODO::\n\n Split this class into 2 classes, the base class for the Lie\n algebra corresponding to the full associative algebra and a\n subclass for the Lie subalgebra (of the full algebra)\n generated by a generating set?\n\n .. TODO::\n\n Return the subalgebra generated by the basis\n elements of ``self`` for the universal enveloping algebra.\n\n EXAMPLES:\n\n For the first example, we start with a commutative algebra.\n Note that the bracket of everything will be 0::\n\n sage: R = SymmetricGroupAlgebra(QQ, 2)\n sage: L = LieAlgebra(associative=R)\n sage: x, y = L.basis()\n sage: L.bracket(x, y)\n 0\n\n Next we use a free algebra and do some simple computations::\n\n sage: R.<a,b> = FreeAlgebra(QQ, 2)\n sage: L = LieAlgebra(associative=R)\n sage: x,y = L(a), L(b)\n sage: x-y\n a - b\n sage: L.bracket(x-y, x)\n a*b - b*a\n sage: L.bracket(x-y, L.bracket(x,y))\n a^2*b - 2*a*b*a + a*b^2 + b*a^2 - 2*b*a*b + b^2*a\n\n We can also use a subset of the generators as a generating set\n of the Lie algebra::\n\n sage: R.<a,b,c> = FreeAlgebra(QQ, 3)\n sage: L.<x,y> = LieAlgebra(associative=[a,b])\n\n Now for a more complicated example using the group ring of `S_3`\n as our base algebra::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L.<x,y> = LieAlgebra(associative=S.gens())\n sage: L.bracket(x, y)\n (2,3) - (1,3)\n sage: L.bracket(x, y-x)\n (2,3) - (1,3)\n sage: L.bracket(L.bracket(x, y), y)\n 2*(1,2,3) - 2*(1,3,2)\n sage: L.bracket(x, L.bracket(x, y))\n (2,3) - 2*(1,2) + (1,3)\n sage: L.bracket(x, L.bracket(L.bracket(x, y), y))\n 0\n\n Here is an example using matrices::\n\n sage: MS = MatrixSpace(QQ,2)\n sage: m1 = MS([[0, -1], [1, 0]])\n sage: m2 = MS([[-1, 4], [3, 2]])\n sage: L.<x,y> = LieAlgebra(associative=[m1, m2])\n sage: x\n [ 0 -1]\n [ 1 0]\n sage: y\n [-1 4]\n [ 3 2]\n sage: L.bracket(x,y)\n [-7 -3]\n [-3 7]\n sage: L.bracket(y,y)\n [0 0]\n [0 0]\n sage: L.bracket(y,x)\n [ 7 3]\n [ 3 -7]\n sage: L.bracket(x, L.bracket(y,x))\n [-6 14]\n [14 6]\n '
@staticmethod
def __classcall_private__(cls, A, gens=None, names=None, index_set=None, free_lie_algebra=False, category=None):
"\n Normalize input to ensure a unique representation.\n\n TESTS::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L1 = LieAlgebra(associative=tuple(S.gens()), names=['x','y'])\n sage: L2 = LieAlgebra(associative=[ S(G((1,2,3))), S(G((1,2))) ], names='x,y')\n sage: L1 is L2\n True\n\n sage: F.<x,y,z> = FreeAlgebra(QQ)\n sage: L1 = LieAlgebra(associative=F.algebra_generators(), names='x,y,z')\n sage: L2.<x,y,z> = LieAlgebra(associative=F.gens())\n sage: L1 is L2\n True\n "
if (isinstance(A, Parent) and A.category().is_subcategory(Rings())):
if ((gens is None) and (index_set is None)):
try:
index_set = A.basis().keys()
except (AttributeError, NotImplementedError):
pass
else:
gens = A
A = None
if (index_set is None):
try:
index_set = gens.keys()
except (AttributeError, ValueError):
pass
ngens = None
if isinstance(gens, AbstractFamily):
if ((index_set is None) and (names is None)):
index_set = gens.keys()
if (gens.cardinality() < float('inf')):
try:
gens = tuple([gens[i] for i in index_set])
except KeyError:
gens = tuple(gens)
ngens = len(gens)
elif isinstance(gens, dict):
if ((index_set is None) and (names is None)):
index_set = gens.keys()
gens = gens.values()
ngens = len(gens)
elif (gens is not None):
gens = tuple(gens)
ngens = len(gens)
if ((index_set is None) and (names is None)):
index_set = list(range(ngens))
if (ngens is not None):
if (A is None):
A = gens[0].parent()
gens = tuple([A(g) for g in gens])
(names, index_set) = standardize_names_index_set(names, index_set, ngens)
category = LieAlgebras(A.base_ring()).or_subcategory(category)
if ('FiniteDimensional' in A.category().axioms()):
category = category.FiniteDimensional()
if (('WithBasis' in A.category().axioms()) and (gens is None)):
category = category.WithBasis()
if isinstance(A, MatrixSpace):
if (gens is not None):
for g in gens:
g.set_immutable()
return MatrixLieAlgebraFromAssociative(A, gens, names=names, index_set=index_set, category=category)
return super().__classcall__(cls, A, gens, names=names, index_set=index_set, category=category)
def __init__(self, A, gens=None, names=None, index_set=None, category=None):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L = LieAlgebra(associative=S)\n sage: TestSuite(L).run()\n\n TESTS::\n\n sage: from sage.algebras.lie_algebras.lie_algebra import LieAlgebraFromAssociative as LAFA\n sage: LAFA(MatrixSpace(QQ, 0, sparse=True), [], names=())\n Lie algebra generated by () in Full MatrixSpace of 0 by 0 sparse matrices over Rational Field\n '
self._assoc = A
R = self._assoc.base_ring()
LieAlgebraWithGenerators.__init__(self, R, names, index_set, category)
if isinstance(gens, tuple):
d = {self._indices[i]: self.element_class(self, v) for (i, v) in enumerate(gens)}
gens = Family(self._indices, (lambda i: d[i]))
elif (gens is not None):
gens = Family(self._indices, (lambda i: self.element_class(self, gens[i])), name='generator map')
self._gens = gens
LiftMorphismToAssociative(self, self._assoc).register_as_coercion()
def _repr_option(self, key):
"\n Metadata about the :meth:`_repr_` output.\n\n See :meth:`sage.structure.parent._repr_option` for details.\n\n EXAMPLES::\n\n sage: MS = MatrixSpace(QQ,2)\n sage: L.<x> = LieAlgebra(associative=[MS.one()])\n sage: L._repr_option('element_ascii_art')\n True\n "
return self._assoc._repr_option(key)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: LieAlgebra(associative=S)\n Lie algebra of Symmetric group algebra of order 3\n over Rational Field\n sage: LieAlgebra(associative=S.gens())\n Lie algebra generated by ((1,2,3), (1,2))\n in Symmetric group algebra of order 3 over Rational Field\n '
if (self._gens is not None):
return 'Lie algebra generated by {} in {}'.format(tuple(self._gens), self._assoc)
return 'Lie algebra of {}'.format(self._assoc)
def _element_constructor_(self, x):
'\n Convert ``x`` into ``self``.\n\n EXAMPLES::\n\n sage: S = SymmetricGroupAlgebra(QQ, 3)\n sage: L = LieAlgebra(associative=S)\n sage: x,y = S.algebra_generators()\n sage: elt = L(x - y); elt\n [2, 1, 3] - [2, 3, 1]\n sage: elt.parent() is L\n True\n sage: elt == L(x) - L(y)\n True\n sage: L([x, y])\n -[1, 3, 2] + [3, 2, 1]\n sage: L(2)\n 2*[1, 2, 3]\n '
if (isinstance(x, list) and (len(x) == 2)):
return self(x[0])._bracket_(self(x[1]))
return self.element_class(self, self._assoc(x))
def associative_algebra(self):
'\n Return the associative algebra used to construct ``self``.\n\n EXAMPLES::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L = LieAlgebra(associative=S)\n sage: L.associative_algebra() is S\n True\n '
return self._assoc
def lie_algebra_generators(self):
'\n Return the Lie algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L = LieAlgebra(associative=S)\n sage: L.lie_algebra_generators()\n Finite family {(): (), (1,3,2): (1,3,2), (1,2,3): (1,2,3),\n (2,3): (2,3), (1,3): (1,3), (1,2): (1,2)}\n '
if (self._gens is not None):
return self._gens
try:
ngens = self._indices.cardinality()
except AttributeError:
ngens = len(self._indices)
if (ngens < float('inf')):
return Family(list(self._indices), self.monomial)
return Family(self._indices, self.monomial, name='generator map')
def monomial(self, i):
'\n Return the monomial indexed by ``i``.\n\n EXAMPLES::\n\n sage: F.<x,y> = FreeAlgebra(QQ)\n sage: L = LieAlgebra(associative=F)\n sage: L.monomial(x.leading_support())\n x\n '
if (i not in self._assoc.basis().keys()):
raise ValueError('not an index')
return self.element_class(self, self._assoc.monomial(i))
def term(self, i, c=None):
'\n Return the term indexed by ``i`` with coefficient ``c``.\n\n EXAMPLES::\n\n sage: F.<x,y> = FreeAlgebra(QQ)\n sage: L = LieAlgebra(associative=F)\n sage: L.term(x.leading_support(), 4)\n 4*x\n '
if (i not in self._assoc.basis().keys()):
raise ValueError('not an index')
return self.element_class(self, self._assoc.term(i, c))
@cached_method
def zero(self):
'\n Return the element `0` in ``self``.\n\n EXAMPLES::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L = LieAlgebra(associative=S)\n sage: L.zero()\n 0\n '
return self.element_class(self, self._assoc.zero())
def is_abelian(self):
"\n Return ``True`` if ``self`` is abelian.\n\n EXAMPLES::\n\n sage: R = FreeAlgebra(QQ, 2, 'x,y')\n sage: L = LieAlgebra(associative=R.gens())\n sage: L.is_abelian()\n False\n\n sage: R = PolynomialRing(QQ, 'x,y')\n sage: L = LieAlgebra(associative=R.gens())\n sage: L.is_abelian()\n True\n\n An example with a Lie algebra from the group algebra::\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L = LieAlgebra(associative=S)\n sage: L.is_abelian()\n False\n\n Now we construct a Lie algebra from commuting elements in the group\n algebra::\n\n sage: G = SymmetricGroup(5)\n sage: S = GroupAlgebra(G, QQ)\n sage: gens = map(S, [G((1, 2)), G((3, 4))])\n sage: L.<x,y> = LieAlgebra(associative=gens)\n sage: L.is_abelian()\n True\n "
if self._assoc.is_commutative():
return True
return super().is_abelian()
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: F.<x,y> = FreeAlgebra(QQ)\n\n An infinitely generated example::\n\n sage: L = LieAlgebra(associative=F)\n sage: L.an_element()\n 1\n\n A finitely generated example::\n\n sage: L = LieAlgebra(associative=F.gens())\n sage: L.an_element()\n x + y\n '
G = self.lie_algebra_generators()
if (G.cardinality() < float('inf')):
return self.sum(G)
return G[self._indices.an_element()]
class Element(LieAlgebraElementWrapper):
def _bracket_(self, rhs):
'\n Return the bracket ``[self, rhs]``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, representation="polynomial")\n sage: L.bracket(x, y)\n x*y - y*x\n\n sage: G = SymmetricGroup(3)\n sage: S = GroupAlgebra(G, QQ)\n sage: L.<x,y> = LieAlgebra(associative=S.gens())\n sage: L.bracket(x, y)\n (2,3) - (1,3)\n\n sage: L = lie_algebras.sl(QQ, 2, representation=\'matrix\')\n sage: L.bracket(L.gen(0), L.gen(1))\n [ 1 0]\n [ 0 -1]\n '
ret = ((self.value * rhs.value) - (rhs.value * self.value))
return self.__class__(self.parent(), ret)
def lift_associative(self):
"\n Lift ``self`` to the ambient associative algebra (which\n might be smaller than the universal enveloping algebra).\n\n EXAMPLES::\n\n sage: R = FreeAlgebra(QQ, 3, 'x,y,z')\n sage: L.<x,y,z> = LieAlgebra(associative=R.gens())\n sage: x.lift_associative()\n x\n sage: x.lift_associative().parent()\n Free Algebra on 3 generators (x, y, z) over Rational Field\n "
return self.value
def monomial_coefficients(self, copy=True):
'\n Return the monomial coefficients of ``self`` (if this\n notion makes sense for ``self.parent()``).\n\n EXAMPLES::\n\n sage: R.<x,y,z> = FreeAlgebra(QQ)\n sage: L = LieAlgebra(associative=R)\n sage: elt = L(x) + 2*L(y) - L(z)\n sage: sorted(elt.monomial_coefficients().items())\n [(x, 1), (y, 2), (z, -1)]\n\n sage: L = LieAlgebra(associative=[x,y])\n sage: elt = L(x) + 2*L(y)\n sage: elt.monomial_coefficients()\n Traceback (most recent call last):\n ...\n NotImplementedError: the basis is not defined\n '
if (self.parent()._gens is not None):
raise NotImplementedError('the basis is not defined')
return self.value.monomial_coefficients(copy)
|
class LiftMorphismToAssociative(LiftMorphism):
'\n The natural lifting morphism from a Lie algebra constructed from\n an associative algebra `A` to `A`.\n '
def preimage(self, x):
"\n Return the preimage of ``x`` under ``self``.\n\n EXAMPLES::\n\n sage: R = FreeAlgebra(QQ, 3, 'a,b,c')\n sage: L = LieAlgebra(associative=R)\n sage: x,y,z = R.gens()\n sage: f = R.coerce_map_from(L)\n sage: p = f.preimage(x*y - z); p\n -c + a*b\n sage: p.parent() is L\n True\n "
return self.domain().element_class(self.domain(), x)
def _call_(self, x):
"\n Return the image of ``x`` under ``self``.\n\n EXAMPLES::\n\n sage: R = FreeAlgebra(QQ, 3, 'x,y,z')\n sage: L.<x,y,z> = LieAlgebra(associative=R.gens())\n sage: f = R.coerce_map_from(L)\n sage: a = f(L([x,y]) + z); a\n z + x*y - y*x\n sage: a.parent() is R\n True\n "
return x.value
def section(self):
"\n Return the section map of ``self``.\n\n EXAMPLES::\n\n sage: R = FreeAlgebra(QQ, 3, 'x,y,z')\n sage: L.<x,y,z> = LieAlgebra(associative=R.gens())\n sage: f = R.coerce_map_from(L)\n sage: f.section()\n Generic morphism:\n From: Free Algebra on 3 generators (x, y, z) over Rational Field\n To: Lie algebra generated by (x, y, z) in Free Algebra on 3 generators (x, y, z) over Rational Field\n "
return SetMorphism(Hom(self.codomain(), self.domain()), self.preimage)
|
class MatrixLieAlgebraFromAssociative(LieAlgebraFromAssociative):
'\n A Lie algebra constructed from a matrix algebra.\n\n This means a Lie algebra consisting of matrices,\n with commutator as Lie bracket.\n '
class Element(LieAlgebraMatrixWrapper, LieAlgebraFromAssociative.Element):
def matrix(self):
"\n Return ``self`` as element of the underlying matrix algebra.\n\n OUTPUT:\n\n An instance of the element class of MatrixSpace.\n\n EXAMPLES::\n\n sage: sl3m = lie_algebras.sl(ZZ, 3, representation='matrix')\n sage: e1,e2, f1, f2, h1, h2 = sl3m.gens()\n sage: h1m = h1.matrix(); h1m\n [ 1 0 0]\n [ 0 -1 0]\n [ 0 0 0]\n sage: h1m.parent()\n Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring\n sage: matrix(h2)\n [ 0 0 0]\n [ 0 1 0]\n [ 0 0 -1]\n sage: L = lie_algebras.so(QQ['z'], 5, representation='matrix')\n sage: matrix(L.an_element())\n [ 1 1 0 0 0]\n [ 1 1 0 0 2]\n [ 0 0 -1 -1 0]\n [ 0 0 -1 -1 -1]\n [ 0 1 0 -2 0]\n\n sage: gl2 = lie_algebras.gl(QQ, 2)\n sage: matrix(gl2.an_element())\n [1 1]\n [1 1]\n "
return self.value
_matrix_ = matrix
|
class LieAlgebraHomomorphism_im_gens(Morphism):
"\n A homomorphism of Lie algebras.\n\n Let `\\mathfrak{g}` and `\\mathfrak{g}^{\\prime}` be Lie algebras.\n A linear map `f \\colon \\mathfrak{g} \\to \\mathfrak{g}^{\\prime}` is a\n homomorphism (of Lie algebras) if `f([x, y]) = [f(x), f(y)]` for all\n `x, y \\in \\mathfrak{g}`. Thus homomorphisms are completely determined\n by the image of the generators of `\\mathfrak{g}`.\n\n INPUT:\n\n - ``parent`` -- a homset between two Lie algebras\n - ``im_gens`` -- the image of the generators of the domain\n - ``base_map`` -- a homomorphism to apply to the coefficients.\n It should be a map from the base ring of the domain to the\n base ring of the codomain.\n Note that if base_map is nontrivial then the result will\n not be a morphism in the category of Lie algebras over\n the base ring.\n - ``check`` -- whether to run checks on the validity of the defining data\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n doctest:warning...:\n FutureWarning: The Hall basis has not been fully proven correct, but currently no bugs are known\n See https://github.com/sagemath/sage/issues/16823 for details.\n sage: phi = Lyn.coerce_map_from(H); phi\n Lie algebra morphism:\n From: Free Lie algebra generated by (x, y, z) over Rational Field in the Hall basis\n To: Free Lie algebra generated by (x, y, z) over Rational Field in the Lyndon basis\n Defn: x |--> x\n y |--> y\n z |--> z\n\n You can provide a base map, creating a semilinear map that (sometimes)\n preserves the Lie bracket::\n\n sage: R.<x> = ZZ[]\n sage: K.<i> = NumberField(x^2 + 1)\n sage: cc = K.hom([-i])\n sage: L.<X,Y,Z,W> = LieAlgebra(K, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}})\n sage: M.<A,B,C,D> = LieAlgebra(K, {('A','B'): {'C':1}, ('A','C'): {'D':1}})\n sage: phi = L.morphism({X:A, Y:B, Z:C, W:D}, base_map=cc)\n sage: phi(X)\n A\n sage: phi(i*X)\n -i*A\n sage: all(phi(x.bracket(y)) == phi(x).bracket(phi(y)) for x,y in cartesian_product_iterator([[X,Y,Z,W],[X,Y,Z,W]]))\n True\n\n Note that the Lie bracket should still be preserved, even though the map is no longer linear\n over the base ring::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(K, {('X','Y'): {'Z':i}, ('X','Z'): {'W':1}})\n sage: M.<A,B,C,D> = LieAlgebra(K, {('A','B'): {'C':-i}, ('A','C'): {'D':1}})\n sage: phi = L.morphism({X:A, Y:B, Z:C, W:D}, base_map=cc)\n sage: phi(X.bracket(Y))\n -i*C\n sage: phi(X).bracket(phi(Y))\n -i*C\n "
def __init__(self, parent, im_gens, base_map=None, check=True):
"\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: phi = Lyn.coerce_map_from(H)\n\n We skip the category test because the Homset's element class\n does not match this class::\n\n sage: TestSuite(phi).run(skip=['_test_category'])\n "
Morphism.__init__(self, parent)
if (not isinstance(im_gens, Sequence_generic)):
if (not isinstance(im_gens, (tuple, list))):
im_gens = [im_gens]
im_gens = Sequence(im_gens, parent.codomain(), immutable=True)
if check:
if (len(im_gens) != len(parent.domain().lie_algebra_generators())):
raise ValueError('number of images must equal number of generators')
if ((base_map is not None) and (not ((base_map.domain() is parent.domain().base_ring()) and parent.codomain().base_ring().has_coerce_map_from(base_map.codomain())))):
raise ValueError('invalid base homomorphism')
if (not im_gens.is_immutable()):
import copy
im_gens = copy.copy(im_gens)
im_gens.set_immutable()
self._im_gens = im_gens
self._base_map = base_map
def _repr_type(self):
"\n TESTS::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: f = Lyn.coerce_map_from(H)\n sage: type(f)\n <class 'sage.algebras.lie_algebras.morphism.LieAlgebraHomomorphism_im_gens'>\n sage: f._repr_type()\n 'Lie algebra'\n "
return 'Lie algebra'
def im_gens(self):
"\n Return the images of the generators of the domain.\n\n OUTPUT:\n\n - ``list`` -- a copy of the list of gens (it is safe to change this)\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: f = Lyn.coerce_map_from(H)\n sage: f.im_gens()\n [x, y, z]\n "
return list(self._im_gens)
def base_map(self):
"\n Return the map on the base ring that is part of the defining\n data for this morphism. May return ``None`` if a coercion is used.\n\n EXAMPLES::\n\n sage: R.<x> = ZZ[]\n sage: K.<i> = NumberField(x^2 + 1)\n sage: cc = K.hom([-i])\n sage: L.<X,Y,Z,W> = LieAlgebra(K, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}})\n sage: M.<A,B> = LieAlgebra(K, abelian=True)\n sage: phi = L.morphism({X: A, Y: B}, base_map=cc)\n sage: phi(X)\n A\n sage: phi(i*X)\n -i*A\n sage: phi.base_map()\n Ring endomorphism of Number Field in i with defining polynomial x^2 + 1\n Defn: i |--> -i\n "
return self._base_map
def _richcmp_(self, other, op):
"\n Rich comparisons.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: x,y,z = H.gens()\n sage: f = Hom(Lyn, H)([x,y,z])\n sage: g = Hom(Lyn, H)([x,y,z])\n sage: h = Hom(Lyn, H)([y,x,z])\n sage: f == g\n True\n sage: f is g\n False\n sage: f != h\n True\n "
return richcmp((self._im_gens, self._base_map), (other._im_gens, other._base_map), op)
def __hash__(self):
"\n Return the hash of this morphism.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: phi = Lyn.coerce_map_from(H)\n sage: hash(phi) == hash(phi)\n True\n "
return hash((self._im_gens, self._base_map))
def _repr_defn(self):
"\n Used in constructing string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: phi = Lyn.coerce_map_from(H)\n sage: print(phi._repr_defn())\n x |--> x\n y |--> y\n z |--> z\n "
D = self.domain()
s = '\n'.join((('%s |--> %s' % (x, gen)) for (gen, x) in zip(self._im_gens, D.gens())))
if (s and (self._base_map is not None)):
s += '\nwith map of base ring'
return s
def _call_(self, x):
"\n Evaluate this homomorphism at ``x``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: phi = Lyn.coerce_map_from(H)\n sage: a = H.graded_basis(5)[12]; a\n [z, [y, [x, [x, z]]]]\n sage: phi(a)\n [x, [[x, z], [y, z]]] + [x, [[[x, z], z], y]]\n + [[x, y], [[x, z], z]] + [[x, [y, z]], [x, z]]\n "
return x._im_gens_(self.codomain(), self.im_gens(), base_map=self.base_map())
|
class LieAlgebraHomset(Homset):
'\n Homset between two Lie algebras.\n\n .. TODO::\n\n This is a very minimal implementation which does not\n have coercions of the morphisms.\n '
def __init__(self, X, Y, category=None, base=None, check=True):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, \'x,y,z\')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: HS = Hom(Lyn, H)\n\n We skip the elements test since homsets are not proper parents::\n\n sage: TestSuite(HS).run(skip=["_test_elements"])\n '
if (base is None):
base = X.base_ring()
Homset.__init__(self, X, Y, category, base, check)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: Hom(Lyn, H)\n Set of Lie algebra morphisms\n from Free Lie algebra generated by (x, y, z) over Rational Field in the Lyndon basis\n to Free Lie algebra generated by (x, y, z) over Rational Field in the Hall basis\n "
return 'Set of Lie algebra morphisms from {} to {}'.format(self.domain(), self.codomain())
def __call__(self, im_gens, check=True):
"\n Construct a morphism from ``im_gens``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: HS = Hom(Lyn, H)\n sage: x,y,z = Lyn.gens()\n sage: phi = HS([z,x,y])\n sage: phi(x + Lyn[z,y])\n z - [x, y]\n\n sage: HS = Hom(Lyn, Lyn)\n sage: phi = HS([z,x,y])\n sage: a = Lyn([z, [x, [[y, z], x]]]); a\n [x, [x, [[y, z], z]]] + [x, [[x, z], [y, z]]] - [[x, [y, z]], [x, z]]\n sage: phi(a)\n [[x, [[y, z], z]], y] + 2*[[[x, z], [y, z]], y] + [[[[x, z], z], y], y]\n sage: phi(phi(phi(a))) == a\n True\n "
if isinstance(im_gens, Morphism):
return im_gens
from sage.categories.lie_algebras import LieAlgebras
if ((self.domain() in LieAlgebras.FiniteDimensional.WithBasis) and (self.codomain() in LieAlgebras.FiniteDimensional.WithBasis)):
try:
return LieAlgebraMorphism_from_generators(self.domain(), im_gens, codomain=self.codomain(), check=check)
except (TypeError, ValueError):
pass
return LieAlgebraHomomorphism_im_gens(self, im_gens)
@cached_method
def zero(self):
"\n Return the zero morphism.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z')\n sage: Lyn = L.Lyndon()\n sage: H = L.Hall()\n sage: HS = Hom(Lyn, H)\n sage: HS.zero()\n Generic morphism:\n From: Free Lie algebra generated by (x, y, z) over Rational Field in the Lyndon basis\n To: Free Lie algebra generated by (x, y, z) over Rational Field in the Hall basis\n "
return SetMorphism(self, (lambda x: self.codomain().zero()))
_an_element_ = zero
|
class LieAlgebraMorphism_from_generators(LieAlgebraHomomorphism_im_gens):
"\n A morphism between two Lie algebras defined by images of a\n generating set as a Lie algebra.\n\n This is the Lie algebra morphism `\\phi \\colon L \\to K` defined on\n the chosen basis of `L` to that of `K` be using the image of some\n generating set (as a Lie algebra) of `L`.\n\n INPUT:\n\n - ``on_generators`` -- dictionary ``{X: Y}`` of the images `Y`\n in ``codomain`` of elements `X` of ``domain``\n - ``codomain`` -- a Lie algebra (optional); this is inferred\n from the values of ``on_generators`` if not given\n - ``base_map`` -- a homomorphism to apply to the coefficients.\n It should be a map from the base ring of the domain to the\n base ring of the codomain.\n Note that if base_map is nontrivial then the result will\n not be a morphism in the category of Lie algebras over\n the base ring.\n - ``check`` -- (default: ``True``) boolean; if ``False`` the\n values on the Lie brackets implied by ``on_generators`` will\n not be checked for contradictory values\n\n EXAMPLES:\n\n A reflection of one horizontal vector in the Heisenberg algebra::\n\n sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z':1}})\n sage: phi = L.morphism({X:-X, Y:Y}); phi\n Lie algebra endomorphism of Lie algebra on 3 generators (X, Y, Z) over Rational Field\n Defn: X |--> -X\n Y |--> Y\n Z |--> -Z\n\n There is no Lie algebra morphism that reflects one horizontal vector,\n but not the vertical one::\n\n sage: L.morphism({X:-X, Y:Y, Z:Z})\n Traceback (most recent call last):\n ...\n ValueError: this does not define a Lie algebra morphism;\n contradictory values for brackets of length 2\n\n Checking for mistakes can be disabled, which can produce\n invalid results::\n\n sage: phi = L.morphism({X:-X, Y:Y, Z:Z}, check=False); phi\n Lie algebra endomorphism of Lie algebra on 3 generators (X, Y, Z) over Rational Field\n Defn: X |--> -X\n Y |--> Y\n Z |--> Z\n sage: L[phi(X), phi(Y)] == phi(L[X,Y])\n False\n\n The set of keys must generate the Lie algebra::\n\n sage: L.morphism({X: X})\n Traceback (most recent call last):\n ...\n ValueError: [X] is not a generating set of Lie algebra on 3 generators\n (X, Y, Z) over Rational Field\n\n Over non-fields, generating subsets are more restricted::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z':2}})\n sage: L.morphism({X: X, Y: Y})\n Traceback (most recent call last):\n ...\n ValueError: [X, Y] is not a generating set of Lie algebra on 3\n generators (X, Y, Z) over Integer Ring\n\n The generators do not have to correspond to the defined generating\n set of the domain::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}})\n sage: K.<A,B,C> = LieAlgebra(QQ, {('A','B'): {'C':2}})\n sage: phi = L.morphism({X+2*Y: A, X-Y: B}); phi\n Lie algebra morphism:\n From: Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n To: Lie algebra on 3 generators (A, B, C) over Rational Field\n Defn: X |--> 1/3*A + 2/3*B\n Y |--> 1/3*A - 1/3*B\n Z |--> -2/3*C\n W |--> 0\n sage: phi(X+2*Y)\n A\n sage: phi(X)\n 1/3*A + 2/3*B\n sage: phi(W)\n 0\n sage: phi(Z)\n -2/3*C\n sage: all(K[phi(p), phi(q)] == phi(L[p,q])\n ....: for p in L.basis() for q in L.basis())\n True\n\n A quotient type Lie algebra morphism::\n\n sage: K.<A,B> = LieAlgebra(SR, abelian=True) # needs sage.symbolic\n sage: L.morphism({X: A, Y: B}) # needs sage.symbolic\n Lie algebra morphism:\n From: Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n To: Abelian Lie algebra on 2 generators (A, B) over Symbolic Ring\n Defn: X |--> A\n Y |--> B\n Z |--> 0\n W |--> 0\n "
def __init__(self, on_generators, domain=None, codomain=None, check=True, base_map=None, category=None):
"\n Initialize ``self``.\n\n The keys of ``on_generators`` need to generate ``domain``\n as a Lie algebra.\n\n .. TODO::\n\n It might be possible to extract an explicit bracket relation that\n fails whenever some linear system fails to be solved. This would\n allow outputting an even more explicit error.\n\n TESTS:\n\n Test suite for a morphism::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}})\n sage: K.<A,B,C> = LieAlgebra(QQ, {('A','B'): {'C':2}})\n sage: phi = L.morphism({X+2*Y: A, X-Y: B})\n sage: TestSuite(phi).run(skip=['_test_category'])\n\n Failure of inferring codomain::\n\n sage: L.<X> = LieAlgebra(QQ, abelian=True)\n sage: L.morphism({X: int(1)})\n Traceback (most recent call last):\n ...\n TypeError: codomain <class 'int'> is not a Lie algebra\n\n sage: from sage.algebras.lie_algebras.morphism import LieAlgebraMorphism_from_generators\n sage: LieAlgebraMorphism_from_generators({ZZ(1): X})\n Traceback (most recent call last):\n ...\n TypeError: domain Integer Ring is not a Lie algebra\n sage: LieAlgebraMorphism_from_generators({})\n Traceback (most recent call last):\n ...\n ValueError: no elements to infer domain from\n sage: LieAlgebraMorphism_from_generators({}, domain=L)\n Traceback (most recent call last):\n ...\n ValueError: no elements to infer codomain from\n\n We check that we can specify a base map to get a semi-linear morphism of Lie algebras::\n\n sage: R.<x> = ZZ[]\n sage: K.<i> = NumberField(x^2 + 1)\n sage: cc = K.hom([-i])\n sage: L.<X,Y,Z> = LieAlgebra(K, {('X','Y'): {'Z':i}})\n sage: M.<A,B,C> = LieAlgebra(K, {('A','B'): {'C':-i}})\n sage: phi = L.morphism({X:A, Y:B, Z:C}, base_map=cc)\n sage: phi(Z)\n C\n sage: phi(i*Z)\n -i*C\n "
from sage.categories.lie_algebras import LieAlgebras
cm = get_coercion_model()
if (domain is None):
if (not on_generators):
raise ValueError('no elements to infer domain from')
domain = cm.common_parent(*on_generators)
if (domain not in LieAlgebras):
raise TypeError(('domain %s is not a Lie algebra' % domain))
if (codomain is None):
if (not on_generators):
raise ValueError('no elements to infer codomain from')
codomain = cm.common_parent(*list(on_generators.values()))
if (codomain not in LieAlgebras):
raise TypeError(('codomain %s is not a Lie algebra' % codomain))
parent = Hom(domain, codomain, category=category)
m = domain.module()
cm = codomain.module()
spanning_set = [X.to_vector() for X in on_generators]
im_gens = [Y.to_vector() for Y in on_generators.values()]
if (not im_gens):
LieAlgebraHomomorphism_im_gens.__init__(self, parent, [], base_map=base_map, check=check)
return
def solve_linear_system(A, b, check):
R = cm.base_ring()
A_inv = A.solve_left(matrix.identity(A.ncols()))
if check:
M = (A * A_inv)
for (Mi, bk) in zip(M.rows(), b):
test_bk = sum(((R(Mij) * bj) for (Mij, bj) in zip(Mi, b)), cm.zero())
if (test_bk != bk):
raise ValueError('contradictory linear system')
return [sum(((R(Aij) * bk) for (Aij, bk) in zip(Ai, b)), cm.zero()) for Ai in A_inv.rows()]
bracketlength = 1
n = 0
while True:
sm = m.submodule(spanning_set)
A = matrix(sm.base_ring(), [sm.coordinate_vector(X) for X in spanning_set])
if (base_map is not None):
A = A.apply_map(base_map)
try:
im_gens = solve_linear_system(A, im_gens, check)
except ValueError:
raise ValueError(('this does not define a Lie algebra morphism; contradictory values for brackets of length %d' % bracketlength))
spanning_set = list(sm.basis())
if (n == len(spanning_set)):
break
bracketlength += 1
n = len(spanning_set)
for (i, j) in combinations(range(n), 2):
Z = domain.bracket(spanning_set[i], spanning_set[j])
imZ = codomain.bracket(im_gens[i], im_gens[j])
spanning_set.append(Z.to_vector())
im_gens.append(imZ.to_vector())
if (not sm.has_coerce_map_from(m)):
raise ValueError(('%s is not a generating set of %s' % (list(on_generators), domain)))
A = matrix(m.base_ring(), spanning_set)
im_gens = solve_linear_system(A, im_gens, check)
LieAlgebraHomomorphism_im_gens.__init__(self, parent, im_gens, base_map=base_map, check=check)
def _call_(self, x):
"\n Evaluate this homomorphism at ``x``.\n\n EXAMPLES::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}})\n sage: K.<A,B> = LieAlgebra(SR, abelian=True) # needs sage.symbolic\n sage: phi = L.morphism({X: A, Y: B}) # needs sage.symbolic\n sage: phi(X) # needs sage.symbolic\n A\n sage: phi(Y) # needs sage.symbolic\n B\n sage: phi(Z) # needs sage.symbolic\n 0\n sage: phi(W) # needs sage.symbolic\n 0\n sage: phi(-X + 3*Y) # needs sage.symbolic\n -A + 3*B\n\n sage: K.<A,B,C> = LieAlgebra(QQ, {('A','B'): {'C':2}})\n sage: phi = L.morphism({X+2*Y: A, X-Y: B})\n sage: phi(X)\n 1/3*A + 2/3*B\n sage: phi(Y)\n 1/3*A - 1/3*B\n sage: phi(3*X+Y)\n 4/3*A + 5/3*B\n sage: phi(3/2*W-Z+Y)\n 1/3*A - 1/3*B + 2/3*C\n "
C = self.codomain()
bh = self._base_map
if (bh is None):
bh = (lambda t: t)
return C.sum(((bh(c) * self._im_gens[i]) for (i, c) in x.to_vector().items()))
|
class NilpotentLieAlgebra_dense(LieAlgebraWithStructureCoefficients):
"\n A nilpotent Lie algebra `L` over a base ring.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``s_coeff`` -- a dictionary of structural coefficients\n - ``names`` -- (default:``None``) list of strings to use as names of basis\n elements; if ``None``, the names will be inferred from the structural\n coefficients\n - ``index_set`` -- (default:``None``) list of hashable and comparable\n elements to use for indexing\n - ``step`` -- (optional) an integer; the nilpotency step of the\n Lie algebra if known; otherwise it will be computed when needed\n - ``category`` -- (optional) a subcategory of finite dimensional\n nilpotent Lie algebras with basis\n\n EXAMPLES:\n\n The input to a :class:`NilpotentLieAlgebra_dense` should be of the\n same form as to a\n :class:`~sage.algebras.lie_algebras.structure_coefficients.LieAlgebraWithStructureCoefficients`::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)\n sage: L\n Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: L[X, Y]\n Z\n sage: L[X, W]\n 0\n\n If the parameter ``names`` is omitted, then the terms appearing in the\n structural coefficients are used as names::\n\n sage: L = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True); L\n Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field\n\n TESTS::\n\n sage: L = LieAlgebra(QQ, {('X','Y'): {'Z': 1},\n ....: ('X','Z'): {'W': 1},\n ....: ('Y','Z'): {'T': 1}}, nilpotent=True)\n sage: TestSuite(L).run()\n "
@staticmethod
def __classcall_private__(cls, R, s_coeff, names=None, index_set=None, category=None, **kwds):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES:\n\n If the variable order is specified, the order of structural\n coefficients does not matter::\n\n sage: from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense\n sage: L1.<x,y,z> = NilpotentLieAlgebra_dense(QQ, {('x','y'): {'z': 1}})\n sage: L2.<x,y,z> = NilpotentLieAlgebra_dense(QQ, {('y','x'): {'z': -1}})\n sage: L1 is L2\n True\n\n If the variables are implicitly defined by the structural coefficients,\n the ordering may be different and the Lie algebras will be considered\n different::\n\n sage: from sage.algebras.lie_algebras.nilpotent_lie_algebra import NilpotentLieAlgebra_dense\n sage: L1 = NilpotentLieAlgebra_dense(QQ, {('x','y'): {'z': 1}})\n sage: L2 = NilpotentLieAlgebra_dense(QQ, {('y','x'): {'z': -1}})\n sage: L1\n Nilpotent Lie algebra on 3 generators (x, y, z) over Rational Field\n sage: L2\n Nilpotent Lie algebra on 3 generators (y, x, z) over Rational Field\n sage: L1 is L2\n False\n\n Constructed using two different methods from :class:`LieAlgebra`\n yields the same Lie algebra::\n\n sage: sc = {('X','Y'): {'Z': 1}}\n sage: C = LieAlgebras(QQ).Nilpotent().FiniteDimensional().WithBasis()\n sage: L1.<X,Y,Z> = LieAlgebra(QQ, sc, category=C)\n sage: L2 = LieAlgebra(QQ, sc, nilpotent=True, names=['X','Y','Z'])\n sage: L1 is L2\n True\n "
if (not names):
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)
cat = LieAlgebras(R).FiniteDimensional().WithBasis().Nilpotent()
category = cat.or_subcategory(category)
return super().__classcall__(cls, R, s_coeff, names, index_set, category=category, **kwds)
def __init__(self, R, s_coeff, names, index_set, step=None, **kwds):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)\n sage: TestSuite(L).run()\n "
if (step is not None):
self._step = step
LieAlgebraWithStructureCoefficients.__init__(self, R, s_coeff, names, index_set, **kwds)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True)\n sage: L\n Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n "
return ('Nilpotent %s' % super()._repr_())
|
class FreeNilpotentLieAlgebra(NilpotentLieAlgebra_dense):
"\n Return the free nilpotent Lie algebra of step ``s`` with ``r`` generators.\n\n The free nilpotent Lie algebra `L` of step `s` with `r` generators is\n the quotient of the free Lie algebra on `r` generators by the `(s+1)`-th\n term of the lower central series. That is, the only relations in the\n Lie algebra `L` are anticommutativity, the Jacobi identity, and the\n vanishing of all brackets of length more than `s`.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``r`` -- an integer; the number of generators\n - ``s`` -- an integer; the nilpotency step of the algebra\n - ``names`` -- (optional) a string or a list of strings used to name the\n basis elements; if ``names`` is a string, then names for the basis\n will be autogenerated as determined by the ``naming`` parameter\n - ``naming`` -- (optional) a string; the naming scheme to use for\n the basis; valid values are:\n\n * ``'index'`` - (default for `r < 10`) the basis elements are\n ``names_w``, where ``w`` are Lyndon words indexing the basis\n * ``'linear'`` - (default for `r \\geq 10`) the basis is indexed\n ``names_1``, ..., ``names_n`` in the ordering of the Lyndon basis\n\n .. NOTE::\n\n The ``'index'`` naming scheme is not supported if `r \\geq 10`\n since it leads to ambiguous names.\n\n EXAMPLES:\n\n We compute the free step 4 Lie algebra on 2 generators and\n verify the only non-trivial relation\n `[[X_1,[X_1,X_2]],X_2] = [X_1,[[X_1,X_2],X_2]]`::\n\n sage: L = LieAlgebra(QQ, 2, step=4)\n sage: L.basis().list()\n [X_1, X_2, X_12, X_112, X_122, X_1112, X_1122, X_1222]\n sage: X_1, X_2 = L.basis().list()[:2]\n sage: L[[X_1, [X_1, X_2]], X_2]\n X_1122\n sage: L[[X_1, [X_1, X_2]], X_2] == L[X_1, [[X_1, X_2], X_2]]\n True\n\n The linear naming scheme on the same Lie algebra::\n\n sage: K = LieAlgebra(QQ, 2, step=4, names='Y', naming='linear')\n sage: K.basis().list()\n [Y_1, Y_2, Y_3, Y_4, Y_5, Y_6, Y_7, Y_8]\n sage: K.inject_variables()\n Defining Y_1, Y_2, Y_3, Y_4, Y_5, Y_6, Y_7, Y_8\n sage: Y_2.bracket(Y_3)\n -Y_5\n sage: Y_5.bracket(Y_1)\n -Y_7\n sage: Y_3.bracket(Y_4)\n 0\n\n A fully custom naming scheme on the Heisenberg algebra::\n\n sage: L = LieAlgebra(ZZ, 2, step=2, names=('X', 'Y', 'Z'))\n sage: a, b, c = L.basis()\n sage: L.basis().list()\n [X, Y, Z]\n sage: a.bracket(b)\n Z\n\n An equivalent way to define custom names for the basis elements and\n bind them as local variables simultaneously::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, 2, step=2)\n sage: L.basis().list()\n [X, Y, Z]\n sage: X.bracket(Y)\n Z\n\n A free nilpotent Lie algebra is a stratified nilpotent Lie algebra::\n\n sage: L = LieAlgebra(QQ, 3, step=3)\n sage: L.category()\n Category of finite dimensional stratified Lie algebras with basis over Rational Field\n sage: L in LieAlgebras(QQ).Nilpotent()\n True\n\n Being graded means that each basis element has a degree::\n\n sage: L in LieAlgebras(QQ).Graded()\n True\n sage: L.homogeneous_component_basis(1).list()\n [X_1, X_2, X_3]\n sage: L.homogeneous_component_basis(2).list()\n [X_12, X_13, X_23]\n sage: L.homogeneous_component_basis(3).list()\n [X_112, X_113, X_122, X_123, X_132, X_133, X_223, X_233]\n\n TESTS:\n\n Verify all bracket relations in the free nilpotent Lie algebra of step 5\n with 2 generators::\n\n sage: L = LieAlgebra(QQ, 2, step=5)\n sage: L.inject_variables()\n Defining X_1, X_2, X_12, X_112, X_122, X_1112, X_1122, X_1222,\n X_11112, X_11122, X_11212, X_11222, X_12122, X_12222\n sage: [X_1.bracket(Xk) for Xk in L.basis()]\n [0, X_12, X_112, X_1112, X_1122,\n X_11112, X_11122, X_11222, 0, 0, 0, 0, 0, 0]\n sage: [X_2.bracket(Xk) for Xk in L.basis()]\n [-X_12, 0, -X_122, -X_1122, -X_1222,\n -X_11122 + X_11212, -X_11222 - X_12122, -X_12222, 0, 0, 0, 0, 0, 0]\n sage: [X_12.bracket(Xk) for Xk in L.basis()]\n [-X_112, X_122, 0, -X_11212, X_12122, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_112.bracket(Xk) for Xk in L.basis()]\n [-X_1112, X_1122, X_11212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_122.bracket(Xk) for Xk in L.basis()]\n [-X_1122, X_1222, -X_12122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_1112.bracket(Xk) for Xk in L.basis()]\n [-X_11112, X_11122 - X_11212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_1122.bracket(Xk) for Xk in L.basis()]\n [-X_11122, X_11222 + X_12122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_1222.bracket(Xk) for Xk in L.basis()]\n [-X_11222, X_12222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_11112.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_11122.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_11212.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_11222.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_12122.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: [X_12222.bracket(Xk) for Xk in L.basis()]\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n\n The dimensions of the smallest free nilpotent Lie algebras on\n 2 and 3 generators::\n\n sage: l = [LieAlgebra(QQ, 2, step=k) for k in range(1, 7)]\n sage: [L.dimension() for L in l]\n [2, 3, 5, 8, 14, 23]\n sage: l = [LieAlgebra(QQ, 3, step=k) for k in range(1, 4)]\n sage: [L.dimension() for L in l]\n [3, 6, 14]\n\n Verify that a free nilpotent Lie algebra of step `>2` with `>10`\n generators can be created, see :trac:`27018` (see also :trac:`27069`)::\n\n sage: L = LieAlgebra(QQ, 11, step=3)\n sage: L.dimension() == 11 + (11^2-11)/2 + (11^3-11)/3\n True\n "
@staticmethod
def __classcall_private__(cls, R, r, s, names=None, naming=None, category=None, **kwds):
"\n Normalize input to ensure a unique representation.\n\n TESTS::\n\n sage: L1.<X> = LieAlgebra(ZZ, 2, step=2)\n sage: L2 = LieAlgebra(ZZ, 2, step=2, names=['X'])\n sage: L3 = LieAlgebra(ZZ, 2, step=2)\n sage: L1 is L2 and L2 is L3\n True\n "
if (names is None):
names = 'X'
cat = LieAlgebras(R).FiniteDimensional().WithBasis()
category = cat.Graded().Stratified().or_subcategory(category)
return super().__classcall__(cls, R, r, s, names=tuple(names), naming=naming, category=category, **kwds)
def __init__(self, R, r, s, names, naming, category, **kwds):
'\n Initialize ``self``\n\n EXAMPLES::\n\n sage: L = LieAlgebra(ZZ, 2, step=2)\n sage: TestSuite(L).run()\n\n sage: L = LieAlgebra(QQ, 4, step=3)\n sage: TestSuite(L).run() # long time\n '
if ((r not in ZZ) or (r <= 0)):
raise ValueError(('number of generators %s is not a positive integer' % r))
if ((s not in ZZ) or (s <= 0)):
raise ValueError(('step %s is not a positive integer' % s))
from sage.algebras.lie_algebras.lie_algebra import LieAlgebra
free_gen_names = [('F%d' % k) for k in range(r)]
free_gen_names_inv = {val: (i + 1) for (i, val) in enumerate(free_gen_names)}
L = LieAlgebra(R, free_gen_names).Lyndon()
basis_by_deg = {d: [] for d in range(1, (s + 1))}
for d in range(1, (s + 1)):
for X in L.graded_basis(d):
w = tuple((free_gen_names_inv[s] for s in X.leading_support().to_word()))
basis_by_deg[d].append((w, X))
index_set = [ind for d in basis_by_deg for (ind, val) in basis_by_deg[d]]
if ((len(names) == 1) and (len(index_set) > 1)):
if (not naming):
if (r >= 10):
naming = 'linear'
else:
naming = 'index'
if (naming == 'linear'):
names = [('%s_%d' % (names[0], (k + 1))) for k in range(len(index_set))]
elif (naming == 'index'):
if (r >= 10):
raise ValueError("'index' naming scheme not supported for 10 or more generators")
names = [('%s_%s' % (names[0], ''.join((str(s) for s in ind)))) for ind in index_set]
else:
raise ValueError(('unknown naming scheme %s' % naming))
s_coeff = {}
for dx in range(1, (s + 1)):
for dy in range(dx, ((s + 1) - dx)):
if (dx == dy):
for (i, val) in enumerate(basis_by_deg[dx]):
(X_ind, X) = val
for (Y_ind, Y) in basis_by_deg[dy][(i + 1):]:
Z = L[(X, Y)]
if (not Z.is_zero()):
s_coeff[(X_ind, Y_ind)] = {W_ind: Z[W.leading_support()] for (W_ind, W) in basis_by_deg[(dx + dy)]}
else:
for (X_ind, X) in basis_by_deg[dx]:
for (Y_ind, Y) in basis_by_deg[dy]:
Z = L[(X, Y)]
if (not Z.is_zero()):
s_coeff[(X_ind, Y_ind)] = {W_ind: Z[W.leading_support()] for (W_ind, W) in basis_by_deg[(dx + dy)]}
(names, index_set) = standardize_names_index_set(names, index_set)
s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff(s_coeff, index_set)
NilpotentLieAlgebra_dense.__init__(self, R, s_coeff, names, index_set, s, category=category, **kwds)
def _repr_generator(self, w):
"\n Return the string representation of the basis element\n indexed by the word ``w`` in ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 2, step=4)\n sage: L._repr_generator((1, 1, 2, 2))\n 'X_1122'\n sage: L = LieAlgebra(QQ, 2, step=4, naming='linear')\n sage: L._repr_generator((1, 1, 2, 2))\n 'X_7'\n sage: L.<X,Y,Z> = LieAlgebra(QQ, 2, step=2)\n sage: L._repr_generator((1, 2))\n 'Z'\n "
i = self.indices().index(w)
return self.variable_names()[i]
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 2, step=3)\n sage: L\n Free Nilpotent Lie algebra on 5 generators (X_1, X_2, X_12, X_112, X_122) over Rational Field\n '
return ('Free %s' % super()._repr_())
|
class OnsagerAlgebra(LieAlgebraWithGenerators, IndexedGenerators):
"\n The Onsager (Lie) algebra.\n\n The Onsager (Lie) algebra `\\mathcal{O}` is a Lie algebra with\n generators `A_0, A_1` that satisfy\n\n .. MATH::\n\n [A_0, [A_0, [A_0, A_1]]] = -4 [A_0, A_1],\n \\qquad\n [A_1, [A_1, [A_1, A_0]]] = -4 [A_1, A_0].\n\n .. NOTE::\n\n We are using a rescaled version of the usual defining generators.\n\n There exist a basis `\\{A_m, G_n \\mid m \\in \\ZZ, n \\in \\ZZ_{>0}\\}`\n for `\\mathcal{O}` with structure coefficients\n\n .. MATH::\n\n [A_m, A_{m'}] = G_{m-m'},\n \\qquad\n [G_n, G_{n'}] = 0,\n \\qquad\n [G_n, A_m] = 2A_{m-n} - 2A_{m+n},\n\n where `m > m'`.\n\n The Onsager algebra is isomorphic to the subalgebra of the affine\n Lie algebra `\\widehat{\\mathfrak{sl}}_2 = \\mathfrak{sl}_2 \\otimes\n \\CC[t,t^{-1}] \\oplus \\CC K \\oplus \\CC d` that is invariant under\n the Chevalley involution. In particular, we have\n\n .. MATH::\n\n A_i \\mapsto f \\otimes t^i - e \\otimes t^{-i},\n \\qquad\n G_i \\mapsto h \\otimes t^{-i} - h \\otimes t^i.\n\n where `e,f,h` are the Chevalley generators of `\\mathfrak{sl}_2`.\n\n EXAMPLES:\n\n We construct the Onsager algebra and do some basic computations::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.inject_variables()\n Defining A0, A1\n\n We verify the defining relations::\n\n sage: O([A0, [A0, [A0, A1]]]) == -4 * O([A0, A1])\n True\n sage: O([A1, [A1, [A1, A0]]]) == -4 * O([A1, A0])\n True\n\n We check the embedding into `\\widehat{\\mathfrak{sl}}_2`::\n\n sage: L = LieAlgebra(QQ, cartan_type=['A',1,1])\n sage: B = L.basis()\n sage: al = RootSystem(['A',1]).root_lattice().simple_root(1)\n sage: ac = al.associated_coroot()\n sage: def emb_A(i): return B[-al,i] - B[al,-i]\n sage: def emb_G(i): return B[ac,i] - B[ac,-i]\n sage: a0 = emb_A(0)\n sage: a1 = emb_A(1)\n sage: L([a0, [a0, [a0, a1]]]) == -4 * L([a0, a1])\n True\n sage: L([a1, [a1, [a1, a0]]]) == -4 * L([a1, a0])\n True\n\n sage: all(emb_G(n).bracket(emb_A(m)) == 2*emb_A(m-n) - 2*emb_A(m+n)\n ....: for m in range(-10, 10) for n in range(1,10))\n True\n sage: all(emb_A(m).bracket(emb_A(mp)) == emb_G(m-mp)\n ....: for m in range(-10,10) for mp in range(m-10, m))\n True\n\n REFERENCES:\n\n - [Onsager1944]_\n - [DG1982]_\n "
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: TestSuite(O).run()\n '
cat = LieAlgebras(R).WithBasis()
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
IndexedGenerators.__init__(self, FiniteEnumeratedSet([0, 1]))
LieAlgebraWithGenerators.__init__(self, R, index_set=self._indices, names=('A0', 'A1'), category=cat)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.OnsagerAlgebra(QQ)\n Onsager algebra over Rational Field\n '
return 'Onsager algebra over {}'.format(self.base_ring())
def _latex_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: latex(O)\n \\mathcal{O}_{\\Bold{Q}}\n '
from sage.misc.latex import latex
return '\\mathcal{{O}}_{{{}}}'.format(latex(self.base_ring()))
def _repr_generator(self, m):
"\n Return a string representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O._repr_generator((0,-2))\n 'A[-2]'\n sage: O._repr_generator((1,4))\n 'G[4]'\n "
if (m[0] == 0):
return 'A[{}]'.format(m[1])
return 'G[{}]'.format(m[1])
def _latex_generator(self, m):
"\n Return a LaTeX representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O._latex_generator((0,-2))\n 'A_{-2}'\n sage: O._latex_generator((1,4))\n 'G_{4}'\n "
if (m[0] == 0):
return 'A_{{{}}}'.format(m[1])
return 'G_{{{}}}'.format(m[1])
_repr_term = _repr_generator
_latex_term = _latex_generator
@cached_method
def basis(self):
'\n Return the basis of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.basis()\n Lazy family (Onsager monomial(i))_{i in\n Disjoint union of Family (Integer Ring, Positive integers)}\n '
from sage.rings.integer_ring import ZZ
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
from sage.sets.positive_integers import PositiveIntegers
I = DisjointUnionEnumeratedSets([ZZ, PositiveIntegers()], keepkey=True, facade=True)
return Family(I, self.monomial, name='Onsager monomial')
@cached_method
def lie_algebra_generators(self):
"\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.lie_algebra_generators()\n Finite family {'A0': A[0], 'A1': A[1]}\n "
d = {'A0': self.basis()[(0, 0)], 'A1': self.basis()[(0, 1)]}
return Family(self._names, d.__getitem__)
def bracket_on_basis(self, x, y):
'\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.bracket_on_basis((1,3), (1,9)) # [G, G]\n 0\n sage: O.bracket_on_basis((0,8), (1,13)) # [A, G]\n -2*A[-5] + 2*A[21]\n sage: O.bracket_on_basis((0,-9), (0, 7)) # [A, A]\n -G[16]\n '
if (x[0] == 1):
return self.zero()
R = self.base_ring()
if (y[0] == 1):
d = {(0, (x[1] - y[1])): R((- 2)), (0, (x[1] + y[1])): R(2)}
return self.element_class(self, d)
return self.element_class(self, {(1, (y[1] - x[1])): (- R.one())})
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.an_element()\n -2*A[-3] + A[2] + 3*G[2]\n '
B = self.basis()
return ((B[(0, 2)] - (2 * B[(0, (- 3))])) + (3 * B[(1, 2)]))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.some_elements()\n [A[0], A[2], A[-1], G[4], -2*A[-3] + A[2] + 3*G[2]]\n '
B = self.basis()
return [B[(0, 0)], B[(0, 2)], B[(0, (- 1))], B[(1, 4)], self.an_element()]
def quantum_group(self, q=None, c=None):
'\n Return the quantum group of ``self``.\n\n The corresponding quantum group is the\n :class:`~sage.algebras.lie_algebras.onsager.QuantumOnsagerAlgebra`.\n The parameter `c` must be such that `c(1) = 1`\n\n INPUT:\n\n - ``q`` -- (optional) the quantum parameter; the default\n is `q \\in R(q)`, where `R` is the base ring of ``self``\n - ``c`` -- (optional) the parameter `c`; the default is ``q``\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q\n q-Onsager algebra with c=q over Fraction Field of\n Univariate Polynomial Ring in q over Rational Field\n '
if (q is None):
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
q = PolynomialRing(self.base_ring(), 'q').fraction_field().gen()
if (c is None):
c = q
else:
c = q.parent()(c)
return QuantumOnsagerAlgebra(self, q, c)
def alternating_central_extension(self):
'\n Return the alternating central extension of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: ACE\n Alternating central extension of the Onsager algebra over Rational Field\n '
return OnsagerAlgebraACE(self.base_ring())
Element = LieAlgebraElement
|
class QuantumOnsagerAlgebra(CombinatorialFreeModule):
'\n The quantum Onsager algebra.\n\n The *quantum Onsager algebra*, or `q`-Onsager algebra, is a\n quantum group analog of the Onsager algebra. It is the left\n (or right) coideal subalgebra of the quantum group\n `U_q(\\widehat{\\mathfrak{sl}}_2)` and is the simplest example\n of a quantum symmetric pair coideal subalgebra of affine type.\n\n The `q`-Onsager algebra depends on a parameter `c` such that\n `c(1) = 1`. The `q`-Onsager algebra with parameter `c` is denoted\n `U_q(\\mathcal{O}_R)_c`, where `R` is the base ring of the\n defining Onsager algebra.\n\n EXAMPLES:\n\n We create the `q`-Onsager algebra and its generators::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: G = Q.algebra_generators()\n\n The generators are given as pairs, where `G[0,n]` is the generator\n `B_{n\\delta+\\alpha_1}` and `G[1,n]` is the generator `B_{n\\delta}`.\n We use the convention that\n `n\\delta + \\alpha_1 \\equiv (-n-1)\\delta + \\alpha_0`. ::\n\n sage: G[0,5]\n B[5d+a1]\n sage: G[0,-5]\n B[4d+a0]\n sage: G[1,5]\n B[5d]\n sage: (G[0,5] + G[0,-3]) * (G[1,2] - G[0,3])\n B[2d+a0]*B[2d] - B[2d+a0]*B[3d+a1]\n + ((-q^4+1)/q^2)*B[1d]*B[6d+a1]\n + ((q^4-1)/q^2)*B[1d]*B[4d+a1] + B[2d]*B[5d+a1]\n - B[5d+a1]*B[3d+a1] + ((q^2+1)/q^2)*B[7d+a1]\n + ((q^6+q^4-q^2-1)/q^2)*B[5d+a1] + (-q^4-q^2)*B[3d+a1]\n sage: (G[0,5] + G[0,-3] + G[1,4]) * (G[0,2] - G[1,3])\n -B[2d+a0]*B[3d] + B[2d+a0]*B[2d+a1]\n + ((q^4-1)/q^4)*B[1d]*B[7d+a1]\n + ((q^8-2*q^4+1)/q^4)*B[1d]*B[5d+a1]\n + (-q^4+1)*B[1d]*B[3d+a1] + ((q^4-1)/q^2)*B[2d]*B[6d+a1]\n + ((-q^4+1)/q^2)*B[2d]*B[4d+a1] - B[3d]*B[4d]\n - B[3d]*B[5d+a1] + B[4d]*B[2d+a1] + B[5d+a1]*B[2d+a1]\n + ((-q^2-1)/q^4)*B[8d+a1] + ((-q^6-q^4+q^2+1)/q^4)*B[6d+a1]\n + (-q^6-q^4+q^2+1)*B[4d+a1] + (q^6+q^4)*B[2d+a1]\n\n We check the `q`-Dolan-Grady relations::\n\n sage: def q_dolan_grady(a, b, q):\n ....: x = q*a*b - ~q*b*a\n ....: y = ~q*a*x - q*x*a\n ....: return a*y - y*a\n sage: A0, A1 = G[0,-1], G[0,0]\n sage: q = Q.q()\n sage: q_dolan_grady(A1, A0, q) == (q^4 + 2*q^2 + 1) * (A0*A1 - A1*A0)\n True\n sage: q_dolan_grady(A0, A1, q) == (q^4 + 2*q^2 + 1) * (A1*A0 - A0*A1)\n True\n\n REFERENCES:\n\n - [BK2017]_\n '
def __init__(self, g, q, c):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: TestSuite(Q).run() # long time\n '
self._g = g
self._q = q
self._c = c
self._q_two = (q + (~ q))
R = self._q_two.parent()
from sage.monoids.indexed_free_monoid import IndexedFreeAbelianMonoid
monomials = IndexedFreeAbelianMonoid(g.basis().keys(), prefix='B', bracket=False, sorting_key=self._monoid_key)
CombinatorialFreeModule.__init__(self, R, monomials, prefix='', bracket=False, latex_bracket=False, sorting_key=self._monomial_key, category=Algebras(R).WithBasis().Filtered())
def _basis_key(self, k):
'\n Key for ordering the basis elements of ``self._g``.\n\n We choose a key in order to obtain the ordering from [BK2017]_\n in the quantum group.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q._basis_key((0,2))\n (1, -2)\n sage: Q._basis_key((0,-2))\n (-1, 2)\n sage: Q._basis_key((1,2))\n (0, 2)\n '
if (k[0] == 0):
if (k[1] < 0):
return ((- 1), (- k[1]))
else:
return (1, (- k[1]))
return (0, k[1])
def _monoid_key(self, x):
'\n Key function for the underlying monoid of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: G = Q.algebra_generators()\n sage: I = Q._indices.gens()\n sage: I[0,1] * I[1,3] * I[1,2] * I[0,-4]^3 # indirect doctest\n B(0, -4)^3*B(1, 2)*B(1, 3)*B(0, 1)\n '
return self._basis_key(x[0])
def _monomial_key(self, x):
'\n Compute the key for ``x`` so that the comparison is done by\n reverse degree lexicographic order.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: G = Q.algebra_generators()\n sage: G[0,0] * G[1,1] * G[0,-2] # indirect doctest\n (q^2-1)*B[a0]^2*B[1d] + q^2*B[1d+a0]*B[1d]*B[a1]\n + ((q^6-2*q^2-1)/q^2)*B[a0]*B[1d+a0] + (-q^4-q^2)*B[a0]*B[a1]\n + (q^4+q^2)*B[1d+a0]*B[1d+a1] + (q^4+q^2)*B[2d+a0]*B[a1]\n + q^2*B[1d]*B[2d] + (-q^4+1)*B[1d] + (q^4+q^2)*B[3d]\n '
return ((- len(x)), [self._basis_key(l) for l in x.to_word_list()])
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: O.quantum_group()\n q-Onsager algebra with c=q over Fraction Field of\n Univariate Polynomial Ring in q over Rational Field\n '
return '{}-Onsager algebra with c={} over {}'.format(self._q, self._c, self.base_ring())
def _latex_(self):
'\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group(q=-1)\n sage: latex(Q)\n U_{-1}(\\mathcal{O}_{\\Bold{Q}})_{-1}\n '
from sage.misc.latex import latex
return 'U_{{{}}}(\\mathcal{{O}}_{{{}}})_{{{}}}'.format(latex(self._q), latex(self._g.base_ring()), latex(self._c))
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: I = Q._indices.gens()\n sage: Q._repr_term(I[0,3])\n 'B[3d+a1]'\n sage: Q._repr_term(I[0,-3])\n 'B[2d+a0]'\n sage: Q._repr_term(I[1,3])\n 'B[3d]'\n sage: Q._repr_term(I[0,-1]^2 * I[1,3]^13 * I[0,3])\n 'B[a0]^2*B[3d]^13*B[3d+a1]'\n "
def to_str(x):
(k, e) = x
if (k[0] == 0):
if (k[1] == (- 1)):
ret = 'B[a0]'
elif (k[1] == 0):
ret = 'B[a1]'
elif (k[1] < (- 1)):
ret = 'B[{}d+a0]'.format(((- k[1]) - 1))
elif (k[1] > 0):
ret = 'B[{}d+a1]'.format(k[1])
else:
ret = 'B[{}d]'.format(k[1])
if (e > 1):
ret = (ret + '^{}'.format(e))
return ret
return '*'.join((to_str(x) for x in m._sorted_items()))
def _latex_term(self, m):
"\n Return a latex representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: I = Q._indices.gens()\n sage: Q._latex_term(I[0,3])\n 'B_{3\\\\delta+\\\\alpha_1}'\n sage: Q._latex_term(I[0,-3])\n 'B_{2\\\\delta+\\\\alpha_0}'\n sage: Q._latex_term(I[1,3])\n 'B_{3\\\\delta}'\n sage: Q._latex_term(I[0,-1]^2 * I[1,3]^13 * I[0,3])\n 'B_{\\\\alpha_0}^{2} B_{3\\\\delta}^{13} B_{3\\\\delta+\\\\alpha_1}'\n "
def to_str(x):
(k, e) = x
if (k[0] == 0):
if (k[1] == (- 1)):
ret = 'B_{\\alpha_0}'
elif (k[1] == 0):
ret = 'B_{\\alpha_1}'
elif (k[1] < (- 1)):
ret = 'B_{{{}\\delta+\\alpha_0}}'.format(((- k[1]) - 1))
elif (k[1] > 0):
ret = 'B_{{{}\\delta+\\alpha_1}}'.format(k[1])
else:
ret = 'B_{{{}\\delta}}'.format(k[1])
if (e > 1):
ret = (ret + '^{{{}}}'.format(e))
return ret
return ' '.join((to_str(x) for x in m._sorted_items()))
def lie_algebra(self):
'\n Return the underlying Lie algebra of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q.lie_algebra()\n Onsager algebra over Rational Field\n sage: Q.lie_algebra() is O\n True\n '
return self._g
def algebra_generators(self):
'\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q.algebra_generators()\n Lazy family (generator map(i))_{i in Disjoint union of\n Family (Integer Ring, Positive integers)}\n '
G = self._indices.gens()
return Family(self._indices._indices, (lambda x: self.monomial(G[x])), name='generator map')
gens = algebra_generators
def q(self):
'\n Return the parameter `q` of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q.q()\n q\n '
return self._q
def c(self):
'\n Return the parameter `c` of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group(c=-3)\n sage: Q.c()\n -3\n '
return self._c
@cached_method
def one_basis(self):
'\n Return the basis element indexing `1`.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: ob = Q.one_basis(); ob\n 1\n sage: ob.parent()\n Free abelian monoid indexed by\n Disjoint union of Family (Integer Ring, Positive integers)\n '
return self._indices.one()
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q.an_element()\n -2*B[2d+a0] + q*B[2d] + B[2d+a1]\n '
G = self.algebra_generators()
return ((G[(0, 2)] - (2 * G[(0, (- 3))])) + (self.base_ring().an_element() * G[(1, 2)]))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: Q.some_elements()\n [B[a1], B[3d+a1], B[a0], B[1d], B[4d]]\n '
G = self.algebra_generators()
return [G[(0, 0)], G[(0, 3)], G[(0, (- 1))], G[(1, 1)], G[(1, 4)]]
def degree_on_basis(self, m):
'\n Return the degree of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: G = Q.algebra_generators()\n sage: B0 = G[0,0]\n sage: B1 = G[0,-1]\n sage: Q.degree_on_basis(B0.leading_support())\n 1\n sage: Q.degree_on_basis((B1^10 * B0^10).leading_support())\n 20\n sage: ((B0 * B1)^3).maximal_degree()\n 6\n '
return m.length()
@cached_method
def product_on_basis(self, lhs, rhs):
'\n Return the product of the two basis elements ``lhs`` and ``rhs``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: I = Q._indices.gens()\n sage: Q.product_on_basis(I[1,21]^2, I[1,31]^3)\n B[21d]^2*B[31d]^3\n sage: Q.product_on_basis(I[1,31]^3, I[1,21]^2)\n B[21d]^2*B[31d]^3\n sage: Q.product_on_basis(I[0,8], I[0,6])\n B[8d+a1]*B[6d+a1]\n sage: Q.product_on_basis(I[0,-8], I[0,6])\n B[7d+a0]*B[6d+a1]\n sage: Q.product_on_basis(I[0,-6], I[0,-8])\n B[5d+a0]*B[7d+a0]\n sage: Q.product_on_basis(I[0,-6], I[1,2])\n B[5d+a0]*B[2d]\n sage: Q.product_on_basis(I[1,6], I[0,2])\n B[6d]*B[2d+a1]\n\n sage: Q.product_on_basis(I[0,1], I[0,2])\n 1/q^2*B[2d+a1]*B[1d+a1] - B[1d]\n sage: Q.product_on_basis(I[0,-3], I[0,-1])\n 1/q^2*B[a0]*B[2d+a0] + ((-q^2+1)/q^2)*B[1d+a0]^2 - B[2d]\n sage: Q.product_on_basis(I[0,2], I[0,-1])\n q^2*B[a0]*B[2d+a1] + ((q^4-1)/q^2)*B[1d+a1]*B[a1]\n + (-q^2+1)*B[1d] + q^2*B[3d]\n sage: Q.product_on_basis(I[0,2], I[1,1])\n B[1d]*B[2d+a1] + (q^2+1)*B[3d+a1] + (-q^2-1)*B[1d+a1]\n sage: Q.product_on_basis(I[0,1], I[1,2])\n ((-q^4+1)/q^2)*B[1d]*B[2d+a1] + ((q^4-1)/q^2)*B[1d]*B[a1]\n + B[2d]*B[1d+a1] + (-q^4-q^2)*B[a0]\n + ((q^2+1)/q^2)*B[3d+a1] + ((q^6+q^4-q^2-1)/q^2)*B[1d+a1]\n sage: Q.product_on_basis(I[1,2], I[0,-1])\n B[a0]*B[2d] + ((-q^4+1)/q^2)*B[1d+a0]*B[1d]\n + ((q^4-1)/q^2)*B[1d]*B[a1] + ((q^2+1)/q^2)*B[2d+a0]\n + ((-q^2-1)/q^2)*B[1d+a1]\n sage: Q.product_on_basis(I[1,2], I[0,-4])\n ((q^4-1)/q^2)*B[2d+a0]*B[1d] + B[3d+a0]*B[2d]\n + ((-q^4+1)/q^2)*B[4d+a0]*B[1d] + (-q^4-q^2)*B[1d+a0]\n + ((q^6+q^4-q^2-1)/q^2)*B[3d+a0] + ((q^2+1)/q^2)*B[5d+a0]\n\n TESTS::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: Q = O.quantum_group()\n sage: G = Q.gens()\n sage: G[0,2]*(G[0,1]*G[0,3]) - (G[0,2]*G[0,1])*G[0,3]\n 0\n sage: G[0,-2]*(G[0,-1]*G[0,-3]) - (G[0,-2]*G[0,-1])*G[0,-3]\n 0\n sage: G[0,1]*(G[0,3]*G[0,-2]) - (G[0,1]*G[0,3])*G[0,-2]\n 0\n sage: G[0,2]*(G[0,1]*G[1,3]) - (G[0,2]*G[0,1])*G[1,3]\n 0\n sage: G[0,-2]*(G[0,1]*G[1,3]) - (G[0,-2]*G[0,1])*G[1,3]\n 0\n sage: G[0,-2]*(G[1,1]*G[1,3]) - (G[0,-2]*G[1,1])*G[1,3]\n 0\n '
if (lhs == self.one_basis()):
return self.monomial(rhs)
if (rhs == self.one_basis()):
return self.monomial(lhs)
I = self._indices
B = I.gens()
q = self._q
kl = lhs.trailing_support()
kr = rhs.leading_support()
if (self._basis_key(kl) <= self._basis_key(kr)):
return self.monomial((lhs * rhs))
if ((kl[0] == 1) and (kr[0] == 1)):
return (self.monomial((lhs * B[kr])) * self.monomial((rhs // B[kr])))
if ((kl[0] == 0) and (kr[0] == 0)):
def a(m, p):
if (p <= ((m - 1) // 2)):
return ((q ** ((- 2) * (p - 1))) * (1 + (q ** (- 2))))
assert ((p == (m // 2)) and ((m % 2) == 0))
return (q ** ((- m) + 2))
if (((kl[1] * kr[1]) > 0) or ((kl[1] == 0) and (kr[1] > 0))):
m = (kr[1] - kl[1])
assert (m > 0)
terms = ((q ** (- 2)) * self.monomial((B[kr] * B[kl])))
terms -= self.monomial(B[(1, m)])
temp = ((- sum((((q ** ((- 2) * (p - 1))) * self.monomial(B[(1, (m - (2 * p)))])) for p in range(1, (((m - 1) // 2) + 1))))) + sum((((a(m, p) * self.monomial(B[(0, (kr[1] - p))])) * self.monomial(B[(0, (p + kl[1]))])) for p in range(1, ((m // 2) + 1)))))
terms += (((q ** (- 2)) - 1) * temp)
else:
r = ((- kr[1]) - 1)
if (r <= kl[1]):
terms = (- self.monomial((B[kr] * B[kl])))
terms -= self.monomial(B[(1, ((r + kl[1]) + 1))])
terms -= (((q ** 2) - 1) * sum((((q ** (2 * k)) * self.monomial(B[(1, (((r + kl[1]) - 1) - (2 * k)))])) for k in range(r))))
terms -= (((q ** 2) - (q ** (- 2))) * sum(((((q ** (2 * ((r - 1) - k))) * self.monomial(B[(0, (- (k + 1)))])) * self.monomial(B[(0, (((- r) + kl[1]) + k))])) for k in range(r))))
m = (((- r) + kl[1]) + 1)
temp = ((- sum((((q ** ((- 2) * (p - 1))) * self.monomial(B[(1, (m - (2 * p)))])) for p in range(1, (((m - 1) // 2) + 1))))) + sum((((a(m, p) * self.monomial(B[(0, ((m - p) - 1))])) * self.monomial(B[(0, (p - 1))])) for p in range(1, ((m // 2) + 1)))))
terms += ((((q ** (- 2)) - 1) * (q ** (2 * r))) * temp)
else:
terms = (- self.monomial((B[kr] * B[kl])))
terms -= self.monomial(B[(1, ((r + kl[1]) + 1))])
terms -= (((q ** 2) - 1) * sum((((q ** (2 * k)) * self.monomial(B[(1, (((r + kl[1]) - 1) - (2 * k)))])) for k in range(kl[1]))))
terms -= (((q ** 2) - (q ** (- 2))) * sum(((((q ** (2 * ((kl[1] - 1) - k))) * self.monomial(B[(0, (- (((r - kl[1]) + k) + 1)))])) * self.monomial(B[(0, k)])) for k in range(kl[1]))))
m = ((r - kl[1]) + 1)
temp = ((- sum((((q ** ((- 2) * (p - 1))) * self.monomial(B[(1, (m - (2 * p)))])) for p in range(1, (((m - 1) // 2) + 1))))) + sum((((a(m, p) * self.monomial(B[(0, (- p))])) * self.monomial(B[(0, (p - m))])) for p in range(1, ((m // 2) + 1)))))
terms += ((((q ** (- 2)) - 1) * (q ** (2 * kl[1]))) * temp)
terms = ((- (q ** 2)) * terms)
elif ((kl[0] == 1) and (kr[0] == 0)):
terms = self.monomial((B[kr] * B[kl]))
assert (kr[1] < 0)
p = ((- kr[1]) - 1)
if (p < kl[1]):
terms += ((self._c * self._q_two) * ((((q ** ((- 2) * (kl[1] - 1))) * self.monomial(B[(0, (- ((kl[1] + p) + 1)))])) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * ((kl[1] - (2 * p)) + (2 * h)))) * self.monomial(B[(0, (- (((kl[1] - p) + (2 * h)) + 1)))])) for h in range(p))))) - ((q ** ((- 2) * ((kl[1] - (2 * p)) - 1))) * self.monomial(B[(0, ((kl[1] - p) - 1))]))))
terms -= (((q ** 2) - (q ** (- 2))) * sum((((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(0, (- ((ell + p) + 1)))] * B[(1, (kl[1] - ell))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(0, (- (((ell + p) - (2 * h)) + 1)))] * B[(1, (kl[1] - ell))]))) for h in range(1, ell))))) - ((q ** (2 * (ell - 1))) * self.monomial((B[(0, (- ((p - ell) + 1)))] * B[(1, (kl[1] - ell))])))) for ell in range(1, (p + 1)))))
terms -= (((q ** 2) - (q ** (- 2))) * sum(((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(0, (- ((ell + p) + 1)))] * B[(1, (kl[1] - ell))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(0, (- (((ell + p) - (2 * h)) + 1)))] * B[(1, (kl[1] - ell))]))) for h in range(1, (p + 1)))))) for ell in range((p + 1), kl[1]))))
terms += (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * ((ell - (2 * p)) - 1))) * self.monomial((B[(1, (kl[1] - ell))] * B[(0, ((ell - p) - 1))]))) for ell in range((p + 1), kl[1]))))
else:
terms += ((self._c * self._q_two) * ((((q ** ((- 2) * (kl[1] - 1))) * self.monomial(B[(0, (- ((p + kl[1]) + 1)))])) + (((q ** 2) - (q ** (- 2))) * sum((((q ** (2 * ((kl[1] - 2) - (2 * h)))) * self.monomial(B[(0, (- ((((p - kl[1]) + 2) + (2 * h)) + 1)))])) for h in range((kl[1] - 1)))))) - ((q ** (2 * (kl[1] - 1))) * self.monomial(B[(0, (- ((p - kl[1]) + 1)))]))))
terms -= (((q ** 2) - (q ** (- 2))) * sum((((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(0, (- ((p + ell) + 1)))] * B[(1, (kl[1] - ell))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(0, (- (((p + ell) - (2 * h)) + 1)))] * B[(1, (kl[1] - ell))]))) for h in range(1, ell))))) - ((q ** (2 * (ell - 1))) * self.monomial((B[(0, (- ((p - ell) + 1)))] * B[(1, (kl[1] - ell))])))) for ell in range(1, kl[1]))))
else:
terms = self.monomial((B[kr] * B[kl]))
if (kl[1] < kr[1]):
terms += ((self._c * self._q_two) * ((((q ** ((- 2) * (kr[1] - 1))) * self.monomial(B[(0, (kr[1] + kl[1]))])) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * ((kr[1] - (2 * kl[1])) + (2 * h)))) * self.monomial(B[(0, ((kr[1] - kl[1]) + (2 * h)))])) for h in range(kl[1]))))) - ((q ** ((- 2) * ((kr[1] - (2 * kl[1])) - 1))) * self.monomial(B[(0, (kl[1] - kr[1]))]))))
terms -= (((q ** 2) - (q ** (- 2))) * sum((((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, (ell + kl[1]))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, ((ell + kl[1]) - (2 * h)))]))) for h in range(1, ell))))) - ((q ** (2 * (ell - 1))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, (kl[1] - ell))])))) for ell in range(1, (kl[1] + 1)))))
terms -= (((q ** 2) - (q ** (- 2))) * sum(((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, (ell + kl[1]))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, ((ell + kl[1]) - (2 * h)))]))) for h in range(1, (kl[1] + 1)))))) for ell in range((kl[1] + 1), kr[1]))))
terms += (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * ((ell - (2 * kl[1])) - 1))) * self.monomial((B[(0, (kl[1] - ell))] * B[(1, (kr[1] - ell))]))) for ell in range((kl[1] + 1), kr[1]))))
else:
terms += ((self._c * self._q_two) * ((((q ** ((- 2) * (kr[1] - 1))) * self.monomial(B[(0, (kl[1] + kr[1]))])) + (((q ** 2) - (q ** (- 2))) * sum((((q ** (2 * ((kr[1] - 2) - (2 * h)))) * self.monomial(B[(0, (((kl[1] - kr[1]) + 2) + (2 * h)))])) for h in range((kr[1] - 1)))))) - ((q ** (2 * (kr[1] - 1))) * self.monomial(B[(0, (kl[1] - kr[1]))]))))
terms -= (((q ** 2) - (q ** (- 2))) * sum((((((q ** ((- 2) * (ell - 1))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, (kl[1] + ell))]))) + (((q ** 2) - (q ** (- 2))) * sum((((q ** ((- 2) * (ell - (2 * h)))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, ((kl[1] + ell) - (2 * h)))]))) for h in range(1, ell))))) - ((q ** (2 * (ell - 1))) * self.monomial((B[(1, (kr[1] - ell))] * B[(0, (kl[1] - ell))])))) for ell in range(1, kr[1]))))
return ((self.monomial((lhs // B[kl])) * terms) * self.monomial((rhs // B[kr])))
|
class OnsagerAlgebraACE(InfinitelyGeneratedLieAlgebra, IndexedGenerators):
'\n The alternating central extension of the Onsager algebra.\n\n The *alternating central extension* of the :class:`Onsager algebra\n <sage.algebras.lie_algebras.onsager.OnsagerAlgebra>` is the Lie algebra\n with basis elements `\\{\\mathcal{A}_k, \\mathcal{B}_k\\}_{k \\in \\ZZ}`\n that satisfy the relations\n\n .. MATH::\n\n \\begin{aligned}\n [\\mathcal{A}_k, \\mathcal{A}_m] & = \\mathcal{B}_{k-m} - \\mathcal{B}_{m-k},\n \\\\ [\\mathcal{A}_k, \\mathcal{B}_m] & = \\mathcal{A}_{k+m} - \\mathcal{A}_{k-m},\n \\\\ [\\mathcal{B}_k, \\mathcal{B}_m] & = 0.\n \\end{aligned}\n\n This has a natural injection from the Onsager algebra by the map `\\iota`\n defined by\n\n .. MATH::\n\n \\iota(A_k) = \\mathcal{A}_k,\n \\qquad\\qquad\n \\iota(B_k) = \\mathcal{B}_k - \\mathcal{B}_{-k}.\n\n Note that the map `\\iota` differs slightly from Lemma 4.18 in [Ter2021b]_\n due to our choice of basis of the Onsager algebra.\n\n .. WARNING::\n\n We have added an extra basis vector `\\mathcal{B}_0`, which would\n be `0` in the definition given in [Ter2021b]_.\n\n EXAMPLES:\n\n We begin by constructing the ACE and doing some sample computations::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: ACE\n Alternating central extension of the Onsager algebra over Rational Field\n\n sage: B = ACE.basis()\n sage: A1, A2, Am2 = B[0,1], B[0,2], B[0,-2]\n sage: B1, B2, Bm2 = B[1,1], B[1,2], B[1,-2]\n sage: A1.bracket(Am2)\n -B[-3] + B[3]\n sage: A1.bracket(A2)\n B[-1] - B[1]\n sage: A1.bracket(B2)\n -A[-1] + A[3]\n sage: A1.bracket(Bm2)\n A[-1] - A[3]\n sage: B2.bracket(B1)\n 0\n sage: Bm2.bracket(B2)\n 0\n sage: (A2 + Am2).bracket(B1 + A2 + B2 + Bm2)\n -A[-3] + A[-1] - A[1] + A[3] + B[-4] - B[4]\n\n The natural inclusion map `\\iota` is implemented as a coercion map::\n\n sage: iota = ACE.coerce_map_from(O)\n sage: b = O.basis()\n sage: am1, a2, b4 = b[0,-1], b[0,2], b[1,4]\n sage: iota(am1.bracket(a2)) == iota(am1).bracket(iota(a2))\n True\n sage: iota(am1.bracket(b4)) == iota(am1).bracket(iota(b4))\n True\n sage: iota(b4.bracket(a2)) == iota(b4).bracket(iota(a2))\n True\n\n sage: am1 + B2\n A[-1] + B[2]\n sage: am1.bracket(B2)\n -A[-3] + A[1]\n sage: Bm2.bracket(a2)\n -A[0] + A[4]\n\n We have the projection map `\\rho` from Lemma 4.19 in [Ter2021b]_:\n\n .. MATH::\n\n \\rho(\\mathcal{A}_k) = A_k,\n \\qquad\\qquad\n \\rho(\\mathcal{B}_k) = \\mathrm{sgn}(k) B_{|k|}.\n\n The kernel of `\\rho` is the center `\\mathcal{Z}`, which has a basis\n `\\{B_k + B_{-k}\\}_{k \\in \\ZZ}`::\n\n sage: rho = ACE.projection()\n sage: rho(A1)\n A[1]\n sage: rho(Am2)\n A[-2]\n sage: rho(B1)\n 1/2*G[1]\n sage: rho(Bm2)\n -1/2*G[2]\n sage: all(rho(B[1,k] + B[1,-k]) == 0 for k in range(-6,6))\n True\n sage: all(B[0,m].bracket(B[1,k] + B[1,-k]) == 0\n ....: for k in range(-4,4) for m in range(-4,4))\n True\n '
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: ACE = lie_algebras.AlternatingCentralExtensionOnsagerAlgebra(QQ)\n sage: TestSuite(ACE).run()\n\n sage: B = ACE.basis()\n sage: A1, A2, Am2 = B[0,1], B[0,2], B[0,-2]\n sage: B1, B2, Bm2 = B[1,1], B[1,2], B[1,-2]\n sage: TestSuite(ACE).run(elements=[A1,A2,Am2,B1,B2,Bm2,ACE.an_element()])\n '
cat = LieAlgebras(R).WithBasis()
from sage.rings.integer_ring import ZZ
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
I = DisjointUnionEnumeratedSets([ZZ, ZZ], keepkey=True, facade=True)
IndexedGenerators.__init__(self, I)
InfinitelyGeneratedLieAlgebra.__init__(self, R, index_set=I, category=cat)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n Alternating central extension of the Onsager algebra over Rational Field\n '
return 'Alternating central extension of the Onsager algebra over {}'.format(self.base_ring())
def _latex_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: latex(O)\n \\mathcal{O}_{\\Bold{Q}}\n '
from sage.misc.latex import latex
return '\\mathcal{{O}}_{{{}}}'.format(latex(self.base_ring()))
def _repr_generator(self, m):
"\n Return a string representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O._repr_generator((0,-2))\n 'A[-2]'\n sage: O._repr_generator((1,4))\n 'B[4]'\n "
if (m[0] == 0):
return 'A[{}]'.format(m[1])
return 'B[{}]'.format(m[1])
def _latex_generator(self, m):
"\n Return a LaTeX representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O._latex_generator((0,-2))\n '\\\\mathcal{A}_{-2}'\n sage: O._latex_generator((1,4))\n '\\\\mathcal{B}_{4}'\n "
if (m[0] == 0):
return '\\mathcal{{A}}_{{{}}}'.format(m[1])
return '\\mathcal{{B}}_{{{}}}'.format(m[1])
_repr_term = _repr_generator
_latex_term = _latex_generator
@cached_method
def basis(self):
'\n Return the basis of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O.basis()\n Lazy family (Onsager ACE monomial(i))_{i in\n Disjoint union of Family (Integer Ring, Integer Ring)}\n '
return Family(self._indices, self.monomial, name='Onsager ACE monomial')
@cached_method
def lie_algebra_generators(self):
'\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O.lie_algebra_generators()\n Lazy family (Onsager ACE monomial(i))_{i in\n Disjoint union of Family (Integer Ring, Integer Ring)}\n '
return self.basis()
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O.an_element()\n -2*A[-3] + A[2] + B[-1] + 3*B[2]\n '
B = self.basis()
return (((B[(0, 2)] - (2 * B[(0, (- 3))])) + (3 * B[(1, 2)])) + B[(1, (- 1))])
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O.some_elements()\n [A[0], A[2], A[-1], B[4], B[-3], -2*A[-3] + A[2] + B[-1] + 3*B[2]]\n '
B = self.basis()
return [B[(0, 0)], B[(0, 2)], B[(0, (- 1))], B[(1, 4)], B[(1, (- 3))], self.an_element()]
def bracket_on_basis(self, x, y):
'\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ).alternating_central_extension()\n sage: O.bracket_on_basis((1,3), (1,9)) # [B, B]\n 0\n sage: O.bracket_on_basis((0,8), (1,13)) # [A, B]\n -A[-5] + A[21]\n sage: O.bracket_on_basis((0,-9), (0, 7)) # [A, A]\n B[-16] - B[16]\n '
if (x[0] == 1):
return self.zero()
R = self.base_ring()
one = R.one()
if (y[0] == 1):
if (y[1] == 0):
return self.zero()
d = {(0, (x[1] - y[1])): (- one), (0, (y[1] + x[1])): one}
else:
d = {(1, (x[1] - y[1])): one, (1, (y[1] - x[1])): (- one)}
return self.element_class(self, d)
def _coerce_map_from_(self, R):
'\n Return if there is a coercion map from ``R``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: ACE.has_coerce_map_from(O) # indirect doctest\n True\n '
if isinstance(R, OnsagerAlgebra):
if R.base_ring().has_coerce_map_from(self.base_ring()):
return R.module_morphism(self._from_onsager_on_basis, codomain=self)
return super()._coerce_map_from_(R)
def _from_onsager_on_basis(self, x):
'\n Map the basis element indexed by ``x`` from the corresponding\n Onsager algebra to ``self``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: ACE._from_onsager_on_basis((0, 2))\n A[2]\n sage: ACE._from_onsager_on_basis((1, 4))\n -B[-4] + B[4]\n\n sage: phi = ACE.coerce_map_from(O)\n sage: a1 = O.basis()[0,1]\n sage: a3 = O.basis()[0,3]\n sage: b2 = O.basis()[1,2]\n sage: phi(a3)\n A[3]\n sage: phi(b2)\n -B[-2] + B[2]\n sage: b2.bracket(a3)\n 2*A[1] - 2*A[5]\n sage: phi(b2).bracket(phi(a3))\n 2*A[1] - 2*A[5]\n sage: phi(b2.bracket(a3))\n 2*A[1] - 2*A[5]\n\n sage: a1.bracket(a3)\n -G[2]\n sage: phi(a1).bracket(phi(a3))\n B[-2] - B[2]\n sage: phi(a1.bracket(a3))\n B[-2] - B[2]\n '
one = self.base_ring().one()
if (x[0] == 0):
return self._from_dict({x: one}, remove_zeros=False)
return self._from_dict({(1, x[1]): one, (1, (- x[1])): (- one)}, remove_zeros=False)
def projection(self):
'\n Return the projection map `\\rho` from Lemma 4.19 in [Ter2021b]_\n to the Onsager algebra.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: rho = ACE.projection()\n sage: B = ACE.basis()\n sage: A1, A2, Am2 = B[0,1], B[0,2], B[0,-2]\n sage: B1, B2, Bm2 = B[1,1], B[1,2], B[1,-2]\n\n sage: rho(A1)\n A[1]\n sage: rho(Am2)\n A[-2]\n sage: rho(B1)\n 1/2*G[1]\n sage: rho(B2)\n 1/2*G[2]\n sage: rho(Bm2)\n -1/2*G[2]\n\n sage: rho(A1.bracket(A2))\n -G[1]\n sage: rho(A1).bracket(rho(A2))\n -G[1]\n sage: rho(B1.bracket(Am2))\n A[-3] - A[-1]\n sage: rho(B1).bracket(rho(Am2))\n A[-3] - A[-1]\n '
O = OnsagerAlgebra(self.base_ring())
return self.module_morphism(self._projection_on_basis, codomain=O)
def _projection_on_basis(self, x):
'\n Compute the projection map `\\rho` on the basis element ``x``.\n\n EXAMPLES::\n\n sage: O = lie_algebras.OnsagerAlgebra(QQ)\n sage: ACE = O.alternating_central_extension()\n sage: ACE._projection_on_basis((0,2))\n A[2]\n sage: ACE._projection_on_basis((1,4))\n 1/2*G[4]\n sage: ACE._projection_on_basis((1,-4))\n -1/2*G[4]\n '
R = self.base_ring()
O = OnsagerAlgebra(R)
if (x[0] == 0):
return O._from_dict({x: R.one()}, remove_zeros=False)
c = (R.one() / 2)
if (x[1] < 0):
return O._from_dict({(1, (- x[1])): (- c)}, remove_zeros=False)
elif (x[1] == 0):
return O.zero()
else:
return O._from_dict({x: c}, remove_zeros=False)
Element = LieAlgebraElement
|
class PoincareBirkhoffWittBasis(CombinatorialFreeModule):
"\n The Poincare-Birkhoff-Witt (PBW) basis of the universal enveloping\n algebra of a Lie algebra.\n\n Consider a Lie algebra `\\mathfrak{g}` with ordered basis\n `(b_1,\\dots,b_n)`. Then the universal enveloping algebra `U(\\mathfrak{g})`\n is generated by `b_1,\\dots,b_n` and subject to the relations\n\n .. MATH::\n\n [b_i, b_j] = \\sum_{k = 1}^n c_{ij}^k b_k\n\n where `c_{ij}^k` are the structure coefficients of `\\mathfrak{g}`. The\n Poincare-Birkhoff-Witt (PBW) basis is given by the monomials\n `b_1^{e_1} b_2^{e_2} \\cdots b_n^{e_n}`. Specifically, we can rewrite\n `b_j b_i = b_i b_j + [b_j, b_i]` where `j > i`, and we can repeat\n this to sort any monomial into\n\n .. MATH::\n\n b_{i_1} \\cdots b_{i_k} = b_1^{e_1} \\cdots b_n^{e_n} + LOT\n\n where `LOT` are lower order terms. Thus the PBW basis is a filtered basis\n for `U(\\mathfrak{g})`.\n\n EXAMPLES:\n\n We construct the PBW basis of `\\mathfrak{sl}_2`::\n\n sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3, names=['E','F','H'])\n sage: PBW = L.pbw_basis()\n\n We then do some computations; in particular, we check that `[E, F] = H`::\n\n sage: E,F,H = PBW.algebra_generators()\n sage: E*F\n PBW['E']*PBW['F']\n sage: F*E\n PBW['E']*PBW['F'] - PBW['H']\n sage: E*F - F*E\n PBW['H']\n\n Next we construct another instance of the PBW basis, but sorted in the\n reverse order::\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: PBW2 = L.pbw_basis(prefix='PBW2', basis_key=neg_key)\n\n We then check the multiplication is preserved::\n\n sage: PBW2(E) * PBW2(F)\n PBW2['F']*PBW2['E'] + PBW2['H']\n sage: PBW2(E*F)\n PBW2['F']*PBW2['E'] + PBW2['H']\n sage: F * E + H\n PBW['E']*PBW['F']\n\n We now construct the PBW basis for Lie algebra of regular\n vector fields on `\\CC^{\\times}`::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: PBW = L.pbw_basis()\n sage: G = PBW.algebra_generators()\n sage: G[2] * G[3]\n PBW[2]*PBW[3]\n sage: G[3] * G[2]\n PBW[2]*PBW[3] + PBW[5]\n sage: G[-2] * G[3] * G[2]\n PBW[-2]*PBW[2]*PBW[3] + PBW[-2]*PBW[5]\n "
@staticmethod
def __classcall_private__(cls, g, basis_key=None, prefix='PBW', **kwds):
"\n Normalize input to ensure a unique representation.\n\n TESTS::\n\n sage: from sage.algebras.lie_algebras.poincare_birkhoff_witt import PoincareBirkhoffWittBasis\n sage: L = lie_algebras.sl(QQ, 2)\n sage: P1 = PoincareBirkhoffWittBasis(L)\n sage: P2 = PoincareBirkhoffWittBasis(L, prefix='PBW')\n sage: P1 is P2\n True\n "
return super().__classcall__(cls, g, basis_key, prefix, **kwds)
def __init__(self, g, basis_key, prefix, **kwds):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: E,F,H = PBW.algebra_generators()\n sage: TestSuite(PBW).run(elements=[E, F, H])\n sage: TestSuite(PBW).run(elements=[E, F, H, E*F + H]) # long time\n '
if (basis_key is not None):
self._basis_key = basis_key
else:
self._basis_key_inverse = None
R = g.base_ring()
self._g = g
monomials = IndexedFreeAbelianMonoid(g.basis().keys(), prefix, sorting_key=self._monoid_key, **kwds)
CombinatorialFreeModule.__init__(self, R, monomials, prefix='', bracket=False, latex_bracket=False, sorting_key=self._monomial_key, category=Algebras(R).WithBasis().Filtered())
def _basis_key(self, x):
"\n Return a key for sorting for the index ``x``.\n\n TESTS::\n\n sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3, names=['E','F','H'])\n sage: PBW = L.pbw_basis()\n sage: PBW._basis_key('E') < PBW._basis_key('H')\n True\n\n ::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: PBW = L.pbw_basis(basis_key=neg_key)\n sage: prod(PBW.gens()) # indirect doctest\n PBW[-alpha[1]]*PBW[alphacheck[1]]*PBW[alpha[1]]\n - 4*PBW[-alpha[1]]*PBW[alpha[1]]\n + PBW[alphacheck[1]]^2\n - 2*PBW[alphacheck[1]]\n\n Check that :trac:`23266` is fixed::\n\n sage: sl2 = lie_algebras.sl(QQ, 2, 'matrix')\n sage: sl2.indices()\n {'e1', 'f1', 'h1'}\n sage: type(sl2.basis().keys())\n <... 'list'>\n sage: Usl2 = sl2.pbw_basis()\n sage: Usl2._basis_key(2)\n 2\n sage: Usl2._basis_key(3)\n Traceback (most recent call last):\n ...\n KeyError: 3\n "
if (self._basis_key_inverse is None):
K = self._g.basis().keys()
if (isinstance(K, (list, tuple)) or (K.cardinality() < float('inf'))):
self._basis_key_inverse = {k: i for (i, k) in enumerate(K)}
else:
self._basis_key_inverse = False
if (self._basis_key_inverse is False):
return x
else:
return self._basis_key_inverse[x]
def _monoid_key(self, x):
'\n Comparison key for the underlying monoid.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: PBW = L.pbw_basis(basis_key=neg_key)\n sage: M = PBW.basis().keys()\n sage: prod(M.gens()) # indirect doctest\n PBW[-alpha[1]]*PBW[alphacheck[1]]*PBW[alpha[1]]\n '
return self._basis_key(x[0])
def _monomial_key(self, x):
'\n Compute the key for ``x`` so that the comparison is done by\n reverse degree lexicographic order.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: E,H,F = PBW.algebra_generators()\n sage: F*H*H*E # indirect doctest\n PBW[alpha[1]]*PBW[alphacheck[1]]^2*PBW[-alpha[1]]\n + 8*PBW[alpha[1]]*PBW[alphacheck[1]]*PBW[-alpha[1]]\n - PBW[alphacheck[1]]^3 + 16*PBW[alpha[1]]*PBW[-alpha[1]]\n - 4*PBW[alphacheck[1]]^2 - 4*PBW[alphacheck[1]]\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: PBW = L.pbw_basis(basis_key=neg_key)\n sage: E,H,F = PBW.algebra_generators()\n sage: E*H*H*F # indirect doctest\n PBW[-alpha[1]]*PBW[alphacheck[1]]^2*PBW[alpha[1]]\n - 8*PBW[-alpha[1]]*PBW[alphacheck[1]]*PBW[alpha[1]]\n + PBW[alphacheck[1]]^3 + 16*PBW[-alpha[1]]*PBW[alpha[1]]\n - 4*PBW[alphacheck[1]]^2 + 4*PBW[alphacheck[1]]\n '
return ((- len(x)), [self._basis_key(l) for l in x.to_word_list()])
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: L.pbw_basis()\n Universal enveloping algebra of\n Lie algebra of ['A', 1] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n "
return 'Universal enveloping algebra of {} in the Poincare-Birkhoff-Witt basis'.format(self._g)
def _coerce_map_from_(self, R):
"\n Return ``True`` if there is a coercion map from ``R`` to ``self``.\n\n EXAMPLES:\n\n We lift from the Lie algebra::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: PBW.has_coerce_map_from(L)\n True\n sage: [PBW(g) for g in L.basis()]\n [PBW[alpha[1]], PBW[alphacheck[1]], PBW[-alpha[1]]]\n\n We can go between PBW bases under different sorting orders::\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: PBW2 = L.pbw_basis(basis_key=neg_key)\n sage: E,H,F = PBW.algebra_generators()\n sage: PBW2(E*H*F)\n PBW[-alpha[1]]*PBW[alphacheck[1]]*PBW[alpha[1]]\n - 4*PBW[-alpha[1]]*PBW[alpha[1]]\n + PBW[alphacheck[1]]^2\n - 2*PBW[alphacheck[1]]\n\n We can lift from another Lie algebra and its PBW basis that\n coerces into the defining Lie algebra::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: LZ = lie_algebras.sl(ZZ, 2)\n sage: L.has_coerce_map_from(LZ) and L != LZ\n True\n sage: PBW = L.pbw_basis()\n sage: PBWZ = LZ.pbw_basis()\n sage: PBW.coerce_map_from(LZ)\n Composite map:\n From: Lie algebra of ['A', 1] in the Chevalley basis\n To: Universal enveloping algebra of Lie algebra of ['A', 1] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n Defn: Coercion map:\n From: Lie algebra of ['A', 1] in the Chevalley basis\n To: Lie algebra of ['A', 1] in the Chevalley basis\n then\n Generic morphism:\n From: Lie algebra of ['A', 1] in the Chevalley basis\n To: Universal enveloping algebra of Lie algebra of ['A', 1] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n sage: PBW.coerce_map_from(PBWZ)\n Generic morphism:\n From: Universal enveloping algebra of Lie algebra of ['A', 1] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n To: Universal enveloping algebra of Lie algebra of ['A', 1] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n\n TESTS:\n\n Check that we can take the preimage (:trac:`23375`)::\n\n sage: L = lie_algebras.cross_product(QQ)\n sage: pbw = L.pbw_basis()\n sage: L(pbw(L.an_element()))\n X + Y + Z\n sage: L(pbw(L.an_element())) == L.an_element()\n True\n sage: L(prod(pbw.gens()))\n Traceback (most recent call last):\n ...\n ValueError: PBW['X']*PBW['Y']*PBW['Z'] is not in the image\n sage: L(pbw.one())\n Traceback (most recent call last):\n ...\n ValueError: 1 is not in the image\n "
if (R == self._g):
I = self._indices
def basis_function(x):
return self.monomial(I.gen(x))
def inv_supp(m):
return (None if (m.length() != 1) else m.leading_support())
return self._g.module_morphism(basis_function, codomain=self, triangular='upper', unitriangular=True, inverse_on_support=inv_supp)
coerce_map = self._g.coerce_map_from(R)
if coerce_map:
return (self.coerce_map_from(self._g) * coerce_map)
if isinstance(R, PoincareBirkhoffWittBasis):
if (self._g == R._g):
I = self._indices
def basis_function(x):
return self.prod((self.monomial((I.gen(g) ** e)) for (g, e) in x._sorted_items()))
return R.module_morphism(basis_function, codomain=self)
coerce_map = self._g.coerce_map_from(R._g)
if coerce_map:
I = self._indices
lift = self.coerce_map_from(self._g)
def basis_function(x):
return self.prod(((lift(coerce_map(g)) ** e) for (g, e) in x._sorted_items()))
return R.module_morphism(basis_function, codomain=self)
return super()._coerce_map_from_(R)
def lie_algebra(self):
'\n Return the underlying Lie algebra of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: PBW.lie_algebra() is L\n True\n '
return self._g
def algebra_generators(self):
'\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: PBW.algebra_generators()\n Finite family {alpha[1]: PBW[alpha[1]], alphacheck[1]: PBW[alphacheck[1]], -alpha[1]: PBW[-alpha[1]]}\n '
G = self._indices.gens()
return Family(self._indices._indices, (lambda x: self.monomial(G[x])), name='generator map')
gens = algebra_generators
@cached_method
def one_basis(self):
"\n Return the basis element indexing `1`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3, names=['E','F','H'])\n sage: PBW = L.pbw_basis()\n sage: ob = PBW.one_basis(); ob\n 1\n sage: ob.parent()\n Free abelian monoid indexed by {'E', 'F', 'H'}\n "
return self._indices.one()
@cached_method
def product_on_basis(self, lhs, rhs):
"\n Return the product of the two basis elements ``lhs`` and ``rhs``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3, names=['E','F','H'])\n sage: PBW = L.pbw_basis()\n sage: I = PBW.indices()\n sage: PBW.product_on_basis(I.gen('E'), I.gen('F'))\n PBW['E']*PBW['F']\n sage: PBW.product_on_basis(I.gen('E'), I.gen('H'))\n PBW['E']*PBW['H']\n sage: PBW.product_on_basis(I.gen('H'), I.gen('E'))\n PBW['E']*PBW['H'] + 2*PBW['E']\n sage: PBW.product_on_basis(I.gen('F'), I.gen('E'))\n PBW['E']*PBW['F'] - PBW['H']\n sage: PBW.product_on_basis(I.gen('F'), I.gen('H'))\n PBW['F']*PBW['H']\n sage: PBW.product_on_basis(I.gen('H'), I.gen('F'))\n PBW['F']*PBW['H'] - 2*PBW['F']\n sage: PBW.product_on_basis(I.gen('H')**2, I.gen('F')**2)\n PBW['F']^2*PBW['H']^2 - 8*PBW['F']^2*PBW['H'] + 16*PBW['F']^2\n\n sage: E,F,H = PBW.algebra_generators()\n sage: E*F - F*E\n PBW['H']\n sage: H * F * E\n PBW['E']*PBW['F']*PBW['H'] - PBW['H']^2\n sage: E * F * H * E\n PBW['E']^2*PBW['F']*PBW['H'] + 2*PBW['E']^2*PBW['F']\n - PBW['E']*PBW['H']^2 - 2*PBW['E']*PBW['H']\n\n TESTS:\n\n Check that :trac:`23268` is fixed::\n\n sage: MS = MatrixSpace(QQ, 2,2)\n sage: gl = LieAlgebra(associative=MS)\n sage: Ugl = gl.pbw_basis()\n sage: prod(Ugl.gens())\n PBW[(0, 0)]*PBW[(0, 1)]*PBW[(1, 0)]*PBW[(1, 1)]\n sage: prod(reversed(list(Ugl.gens())))\n PBW[(0, 0)]*PBW[(0, 1)]*PBW[(1, 0)]*PBW[(1, 1)]\n - PBW[(0, 0)]^2*PBW[(1, 1)] + PBW[(0, 0)]*PBW[(1, 1)]^2\n "
if (lhs == self.one_basis()):
return self.monomial(rhs)
if (rhs == self.one_basis()):
return self.monomial(lhs)
I = self._indices
trail = lhs.trailing_support()
lead = rhs.leading_support()
if (self._basis_key(trail) <= self._basis_key(lead)):
return self.monomial((lhs * rhs))
terms = self._g.monomial(trail).bracket(self._g.monomial(lead))
lead = I.gen(lead)
trail = I.gen(trail)
mc = terms.monomial_coefficients(copy=False)
terms = self.sum_of_terms(((I.gen(t), c) for (t, c) in mc.items()))
terms += self.monomial((lead * trail))
return ((self.monomial((lhs // trail)) * terms) * self.monomial((rhs // lead)))
def degree_on_basis(self, m):
'\n Return the degree of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: PBW = L.pbw_basis()\n sage: E,H,F = PBW.algebra_generators()\n sage: PBW.degree_on_basis(E.leading_support())\n 1\n sage: m = ((H*F)^10).trailing_support(key=PBW._monomial_key) # long time\n sage: PBW.degree_on_basis(m) # long time\n 20\n sage: ((H*F*E)^4).maximal_degree() # long time\n 12\n '
return m.length()
def casimir_element(self, order=2):
"\n Return the Casimir element of ``self``.\n\n .. SEEALSO::\n\n :meth:`~sage.categories.finite_dimensional_lie_algebras_with_basis.FiniteDimensionalLieAlgebrasWithBasis.ParentMethods.casimir_element`\n\n INPUT:\n\n - ``order`` -- (default: ``2``) the order of the Casimir element\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, cartan_type=['G', 2])\n sage: U = L.pbw_basis()\n sage: C = U.casimir_element(); C\n 1/4*PBW[alpha[2]]*PBW[-alpha[2]] + 1/12*PBW[alpha[1]]*PBW[-alpha[1]]\n + 1/12*PBW[alpha[1] + alpha[2]]*PBW[-alpha[1] - alpha[2]] + 1/12*PBW[2*alpha[1] + alpha[2]]*PBW[-2*alpha[1] - alpha[2]]\n + 1/4*PBW[3*alpha[1] + alpha[2]]*PBW[-3*alpha[1] - alpha[2]]\n + 1/4*PBW[3*alpha[1] + 2*alpha[2]]*PBW[-3*alpha[1] - 2*alpha[2]]\n + 1/12*PBW[alphacheck[1]]^2 + 1/4*PBW[alphacheck[1]]*PBW[alphacheck[2]]\n + 1/4*PBW[alphacheck[2]]^2 - 5/12*PBW[alphacheck[1]] - 3/4*PBW[alphacheck[2]]\n sage: all(g * C == C * g for g in U.algebra_generators())\n True\n\n TESTS::\n\n sage: H = lie_algebras.Heisenberg(QQ, oo)\n sage: U = H.pbw_basis()\n sage: U.casimir_element()\n Traceback (most recent call last):\n ...\n ValueError: the Lie algebra must be finite dimensional\n "
from sage.rings.infinity import Infinity
if (self._g.dimension() == Infinity):
raise ValueError('the Lie algebra must be finite dimensional')
return self._g.casimir_element(order=order, UEA=self)
class Element(CombinatorialFreeModule.Element):
def _act_on_(self, x, self_on_left):
'\n Return the action of ``self`` on ``x`` by seeing if there is an\n action of the defining Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: d = L.basis()\n sage: x = d[-1]*d[-2]*d[-1] + 3*d[-3]\n sage: x\n PBW[-2]*PBW[-1]^2 + PBW[-3]*PBW[-1] + 3*PBW[-3]\n sage: M = L.verma_module(1/2,3/4)\n sage: v = M.highest_weight_vector()\n sage: x * v\n 3*d[-3]*v + d[-3]*d[-1]*v + d[-2]*d[-1]*d[-1]*v\n '
ret = x._acted_upon_(self, (not self_on_left))
if (ret is not None):
return ret
cm = get_coercion_model()
L = self.parent()._g
if self_on_left:
if cm.discover_action(L, x.parent(), mul):
ret = x.parent().zero()
for (mon, coeff) in self._monomial_coefficients.items():
term = (coeff * x)
for (k, exp) in reversed(mon._sorted_items()):
for _ in range(exp):
term = (L.monomial(k) * term)
ret += term
return ret
elif cm.discover_action(x.parent(), L, mul):
ret = x.parent().zero()
for (mon, coeff) in self._monomial_coefficients.items():
term = (coeff * x)
for (k, exp) in reversed(mon._sorted_items()):
for _ in range(exp):
term = (term * L.monomial(k))
ret += term
return ret
return None
|
class LieQuotient_finite_dimensional_with_basis(LieAlgebraWithStructureCoefficients):
"\n A quotient Lie algebra.\n\n INPUT:\n\n - ``I`` -- an ideal or a list of generators of the ideal\n - ``ambient`` -- (optional) the Lie algebra to be quotiented;\n will be deduced from ``I`` if not given\n - ``names`` -- (optional) a string or a list of strings;\n names for the basis elements of the quotient. If ``names`` is a\n string, the basis will be named ``names_1``,...,``names_n``.\n\n EXAMPLES:\n\n The Engel Lie algebra as a quotient of the free nilpotent Lie algebra\n of step 3 with 2 generators::\n\n sage: L = LieAlgebra(QQ, 2, step=3)\n sage: L.inject_variables()\n Defining X_1, X_2, X_12, X_112, X_122\n sage: I = L.ideal(X_122)\n sage: E = L.quotient(I); E\n Lie algebra quotient L/I of dimension 4 over Rational Field where\n L: Free Nilpotent Lie algebra on 5 generators (X_1, X_2, X_12, X_112, X_122) over Rational Field\n I: Ideal (X_122)\n sage: E.category()\n Join of Category of finite dimensional nilpotent Lie algebras with basis\n over Rational Field and Category of subquotients of sets\n sage: E.basis().list()\n [X_1, X_2, X_12, X_112]\n sage: E.inject_variables()\n Defining X_1, X_2, X_12, X_112\n sage: X_1.bracket(X_2)\n X_12\n sage: X_1.bracket(X_12)\n X_112\n sage: X_2.bracket(X_12)\n 0\n\n Shorthand for taking a quotient without creating an ideal first::\n\n sage: E2 = L.quotient(X_122); E2\n Lie algebra quotient L/I of dimension 4 over Rational Field where\n L: Free Nilpotent Lie algebra on 5 generators (X_1, X_2, X_12, X_112, X_122) over Rational Field\n I: Ideal (X_122)\n sage: E is E2\n True\n\n Custom names for the basis can be given::\n\n sage: E.<X,Y,Z,W> = L.quotient(X_122)\n sage: E.basis().list()\n [X, Y, Z, W]\n sage: X.bracket(Z)\n W\n sage: Y.bracket(Z)\n 0\n\n The elements can be relabeled linearly by passing a string to the\n ``names`` parameter::\n\n sage: E = L.quotient(X_122, names='Y')\n sage: E.basis().list()\n [Y_1, Y_2, Y_3, Y_4]\n sage: E.inject_variables()\n Defining Y_1, Y_2, Y_3, Y_4\n sage: Y_1.bracket(Y_3)\n Y_4\n sage: Y_2.bracket(Y_3)\n 0\n\n Conversion from the ambient Lie algebra uses the quotient projection::\n\n sage: L = LieAlgebra(QQ, 2, step=3)\n sage: L.inject_variables()\n Defining X_1, X_2, X_12, X_112, X_122\n sage: E = L.quotient(X_122, names='Y')\n sage: E(X_1), E(X_2), E(X_12), E(X_112), E(X_122)\n (Y_1, Y_2, Y_3, Y_4, 0)\n\n A non-stratifiable Lie algebra as a quotient of the free nilpotent Lie\n algebra of step 4 on 2 generators by the relation\n `[X_2, [X_1, X_2]] = [X_1, [X_1, [X_1, X_2]]]`::\n\n sage: L = LieAlgebra(QQ, 2, step=4)\n sage: X_1, X_2 = L.homogeneous_component_basis(1)\n sage: rel = L[X_2, [X_1, X_2]] - L[X_1, [X_1, [X_1, X_2]]]\n sage: Q = L.quotient(rel, names='Y')\n sage: Q.dimension()\n 5\n sage: Q.inject_variables()\n Defining Y_1, Y_2, Y_3, Y_4, Y_5\n sage: lcs = Q.lower_central_series()\n sage: [I.basis().list() for I in lcs]\n [[Y_1, Y_2, Y_3, Y_4, Y_5], [Y_3, Y_4, Y_5], [Y_4, Y_5], [Y_5], []]\n sage: Y_2.bracket(Y_3)\n -Y_5\n\n Quotients when the base ring is not a field are not implemented::\n\n sage: L = lie_algebras.Heisenberg(ZZ, 1)\n sage: L.quotient(L.an_element())\n Traceback (most recent call last):\n ...\n NotImplementedError: quotients over non-fields not implemented\n\n TESTS:\n\n Verify that iterated quotient constructions work::\n\n sage: L = LieAlgebra(QQ, 2, step=3)\n sage: quots = [L]\n sage: for k in range(5):\n ....: L = L.quotient(L.basis().list()[-1])\n ....: quots.append(L)\n sage: [Q.dimension() for Q in quots]\n [5, 4, 3, 2, 1, 0]\n sage: all(Lp is Ln.ambient() for Lp, Ln in zip(quots,quots[1:]))\n True\n sage: X = quots[-2].an_element()\n sage: lifts = [X]\n sage: quots = list(reversed(quots[1:-1]))\n sage: for Q in quots:\n ....: X = Q.lift(X)\n ....: lifts.append(X)\n sage: all(X.parent() is L for X, L in zip(lifts,quots))\n True\n\n Verify a quotient construction when the basis ordering and indices ordering\n are different, see :trac:`26352`::\n\n sage: L.<c,b,a> = LieAlgebra(QQ, abelian=True)\n sage: I2 = L.ideal([a+b, a+c], order=sorted)\n sage: I2.basis()\n Family (b + a, c + a)\n sage: Q = L.quotient(I2)\n sage: Q.basis()\n Finite family {'a': a}\n\n A test suite::\n\n sage: L.<x,y,z,w,u> = LieAlgebra(QQ, 2, step=3)\n sage: K = L.quotient(z + w)\n sage: K.dimension()\n 2\n sage: TestSuite(K).run()\n "
@staticmethod
def __classcall_private__(cls, I, ambient=None, names=None, index_set=None, category=None):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES:\n\n Specifying the ambient Lie algebra is not necessary::\n\n sage: from sage.algebras.lie_algebras.quotient import LieQuotient_finite_dimensional_with_basis\n sage: L.<X,Y> = LieAlgebra(QQ, {('X','Y'): {'X': 1}})\n sage: Q1 = LieQuotient_finite_dimensional_with_basis(X, ambient=L)\n sage: Q2 = LieQuotient_finite_dimensional_with_basis(X)\n sage: Q1 is Q2\n True\n\n Variable names are extracted from the ambient Lie algebra by default::\n\n sage: Q3 = L.quotient(X, names=['Y'])\n sage: Q1 is Q3\n True\n "
if (not isinstance(I, LieSubalgebra_finite_dimensional_with_basis)):
if (ambient is None):
if (not isinstance(I, (list, tuple))):
ambient = I.parent()
else:
ambient = I[0].parent()
I = ambient.ideal(I)
if (ambient is None):
ambient = I.ambient()
if (not ambient.base_ring().is_field()):
raise NotImplementedError('quotients over non-fields not implemented')
I_supp = [X.leading_support() for X in I.leading_monomials()]
inv = ambient.basis().inverse_family()
sorted_indices = [inv[X] for X in ambient.basis()]
index_set = [i for i in sorted_indices if (i not in I_supp)]
if (names is None):
amb_names = dict(zip(sorted_indices, ambient.variable_names()))
names = [amb_names[i] for i in index_set]
elif isinstance(names, str):
if (len(index_set) == 1):
names = [names]
else:
names = [('%s_%d' % (names, (k + 1))) for k in range(len(index_set))]
(names, index_set) = standardize_names_index_set(names, index_set)
cat = LieAlgebras(ambient.base_ring()).FiniteDimensional().WithBasis()
if (ambient in LieAlgebras(ambient.base_ring()).Nilpotent()):
cat = cat.Nilpotent()
category = cat.Subquotients().or_subcategory(category)
return super().__classcall__(cls, I, ambient, names, index_set, category=category)
def __init__(self, I, L, names, index_set, category=None):
"\n Initialize ``self``.\n\n TESTS::\n\n sage: # needs sage.symbolic\n sage: L.<x,y,z> = LieAlgebra(SR, {('x','y'): {'x':1}})\n sage: K = L.quotient(y)\n sage: K.dimension()\n 1\n sage: TestSuite(K).run()\n "
B = L.basis()
sm = L.module().submodule_with_basis([I.reduce(B[i]).to_vector() for i in index_set])
SB = sm.basis()
s_coeff = {}
for (i, ind_i) in enumerate(index_set):
for j in range((i + 1), len(index_set)):
ind_j = index_set[j]
brkt = I.reduce(L.bracket(SB[i], SB[j]))
brktvec = sm.coordinate_vector(brkt.to_vector())
s_coeff[(ind_i, ind_j)] = dict(zip(index_set, brktvec))
s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff(s_coeff, index_set)
self._ambient = L
self._I = I
self._sm = sm
LieAlgebraWithStructureCoefficients.__init__(self, L.base_ring(), s_coeff, names, index_set, category=category)
H = Hom(L, self)
f = SetMorphism(H, self.retract)
self.register_conversion(f)
def _repr_(self):
'\n Return the string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.gl(QQ, 2)\n sage: a,b,c,d = L.basis()\n sage: Q = L.quotient(d); Q\n Lie algebra quotient L/I of dimension 0 over Rational Field where\n L: General linear Lie algebra of rank 2 over Rational Field\n I: Ideal ([0 0]\n [0 1])\n '
return ('Lie algebra quotient L/I of dimension %s over %s where\nL: %s\nI: Ideal %s' % (self.dimension(), self.base_ring(), self.ambient(), self._I._repr_short()))
def _repr_generator(self, i):
"\n Return the string representation of the basis element\n indexed by ``i`` in ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, 2, step=2)\n sage: Q = L.quotient(x + y)\n sage: Q._repr_generator(Q.indices()[0])\n 'x'\n "
ind = self.indices().index(i)
return self.variable_names()[ind]
def ambient(self):
'\n Return the ambient Lie algebra of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, 2, step=2)\n sage: Q = L.quotient(z)\n sage: Q.ambient() == L\n True\n '
return self._ambient
def lift(self, X):
'\n Return some preimage of ``X`` under the quotient projection\n into ``self``.\n\n INPUT:\n\n - ``X`` -- an element of ``self``\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, 2, step=2)\n sage: Q = L.quotient(x + y)\n sage: Q(y)\n -x\n sage: el = Q.lift(Q(y)); el\n -x\n sage: el.parent()\n Free Nilpotent Lie algebra on 3 generators (x, y, z) over Rational Field\n '
L = self.ambient()
B = L.basis()
return L.sum(((ck * B[ik]) for (ik, ck) in X))
def retract(self, X):
'\n Map ``X`` under the quotient projection to ``self``.\n\n INPUT:\n\n - ``X`` -- an element of the ambient Lie algebra\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 3, step=2)\n sage: L.inject_variables()\n Defining X_1, X_2, X_3, X_12, X_13, X_23\n sage: Q = L.quotient(X_1 + X_2 + X_3)\n sage: Q.retract(X_1), Q.retract(X_2), Q.retract(X_3)\n (X_1, X_2, -X_1 - X_2)\n sage: all(Q.retract(Q.lift(X)) == X for X in Q.basis())\n True\n '
X_vec = self._I.reduce(X).to_vector()
return self.from_vector(self._sm.coordinate_vector(X_vec))
def defining_ideal(self):
'\n Return the ideal generating this quotient Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1)\n sage: p,q,z = L.basis()\n sage: Q = L.quotient(p)\n sage: Q.defining_ideal()\n Ideal (p1) of Heisenberg algebra of rank 1 over Rational Field\n '
return self._I
def from_vector(self, v, order=None, coerce=False):
'\n Return the element of ``self`` corresponding to the vector ``v``.\n\n INPUT:\n\n - ``v`` -- a vector in ``self.module()`` or ``self.ambient().module()``\n\n EXAMPLES:\n\n An element from a vector of the intrinsic module::\n\n sage: L.<X,Y,Z> = LieAlgebra(QQ, 3, abelian=True)\n sage: Q = L.quotient(X + Y + Z)\n sage: Q.dimension()\n 2\n sage: el = Q.from_vector([1, 2]); el\n X + 2*Y\n sage: el.parent() == Q\n True\n\n An element from a vector of the ambient module\n\n sage: el = Q.from_vector([1, 2, 3]); el\n -2*X - Y\n sage: el.parent() == Q\n True\n '
if (len(v) == self.ambient().dimension()):
return self.retract(self.ambient().from_vector(v))
return super().from_vector(v)
|
class RankTwoHeisenbergVirasoro(InfinitelyGeneratedLieAlgebra, IndexedGenerators):
'\n The rank 2 Heisenberg-Virasoro algebra.\n\n The *rank 2 Heisenberg-Virasoro* (Lie) algebra is the Lie algebra\n `L` spaned by the elements\n\n .. MATH::\n\n \\{t^{\\alpha}, E(\\alpha) \\mid \\alpha \\in \\ZZ^2 \\setminus \\{(0,0)\\} \\}\n \\cup \\{K_1, K_2, K_3, K_4\\},\n\n which satisfy the relations\n\n .. MATH::\n\n \\begin{aligned}\n \\mbox{ } [t^{\\alpha}, t^{\\beta}] & = [K_i, L] = 0,\n \\\\\n [t^{\\alpha}, E(\\beta)] & =\n \\det\\begin{pmatrix} \\beta \\\\ \\alpha \\end{pmatrix} t^{\\alpha+\\beta}\n + \\delta_{\\alpha,-\\beta} (\\alpha_1 K_1 + \\alpha_2 K_2),\n \\\\\n [E(\\alpha), E(\\beta)] & =\n \\det\\begin{pmatrix} \\beta \\\\ \\alpha \\end{pmatrix} E(\\alpha+\\beta)\n + \\delta_{\\alpha,-\\beta} (\\alpha_1 K_3 + \\alpha_2 K_4),\n \\end{aligned}\n\n where `\\alpha = (\\alpha_1, \\alpha_2)` and `\\delta_{xy}` is the\n Kronecker delta.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: K1,K2,K3,K4 = L.K()\n sage: E2m1 = L.E(2,-1)\n sage: Em21 = L.E(-2,1)\n sage: t2m1 = L.t(2,-1)\n sage: t53 = L.t(5,3)\n\n sage: Em21.bracket(t2m1)\n -2*K1 + K2\n sage: t53.bracket(E2m1)\n 11*t(7, 2)\n sage: E2m1.bracket(Em21)\n 2*K3 - K4\n sage: E2m1.bracket(t2m1)\n 0\n\n sage: all(x.bracket(y) == 0 for x in [K1,K2,K3,K4] for y in [E2m1, Em21, t2m1])\n True\n\n REFERENCES:\n\n - [LT2018]_\n '
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: TestSuite(L).run()\n '
cat = LieAlgebras(R).WithBasis()
self._KI = FiniteEnumeratedSet([1, 2, 3, 4])
self._V = (ZZ ** 2)
d = {'K': self._KI, 'E': self._V, 't': self._V}
indices = DisjointUnionEnumeratedSets(d, keepkey=True, facade=True)
InfinitelyGeneratedLieAlgebra.__init__(self, R, index_set=indices, category=cat)
IndexedGenerators.__init__(self, indices, sorting_key=self._basis_key)
def _basis_key(self, x):
"\n Return the key used to compare two basis element indices.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L._basis_key( ('K',2) )\n (0, 2)\n sage: L._basis_key( ('t',(-1,2)) )\n (1, (-1, 2))\n sage: L._basis_key( ('E',(-1,2)) )\n (2, (-1, 2))\n\n sage: x = L.an_element(); x\n K3 - 1/2*t(-1, 3) + E(1, -3) + E(2, 2)\n sage: sorted(map(L._basis_key, x.support()))\n [(0, 3), (1, (-1, 3)), (2, (1, -3)), (2, (2, 2))]\n "
if (x[0] == 'K'):
return (0, x[1])
if (x[0] == 't'):
return (1, tuple(x[1]))
return (2, tuple(x[1]))
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L._repr_term(('K', 2))\n 'K2'\n sage: L._repr_term(('t', (2,-4)))\n 't(2, -4)'\n sage: L._repr_term(('E', (2,-4)))\n 'E(2, -4)'\n "
return '{}{}'.format(*m)
def _latex_term(self, m):
"\n Return a `\\LaTeX` representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L._latex_term(('K', 2))\n 'K_2'\n sage: L._latex_term(('t', (2,-4)))\n 't^{(2,-4)}'\n sage: L._latex_term(('E', (2,-4)))\n 'E(2,-4)'\n "
if (m[0] == 'K'):
return 'K_{}'.format(m[1])
if (m[0] == 't'):
return 't^{{({},{})}}'.format(m[1][0], m[1][1])
return 'E({},{})'.format(m[1][0], m[1][1])
def _unicode_art_term(self, m):
"\n Return a unicode art representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L._unicode_art_term(('K', 2))\n K₂\n sage: L._unicode_art_term(('t', (2,-4)))\n t⁽²˴⁻⁴⁾\n sage: L._unicode_art_term(('E', (2,-4)))\n E(2,-4)\n "
from sage.typeset.unicode_art import unicode_art, unicode_subscript, unicode_superscript
if (m[0] == 'K'):
return unicode_art(('K' + unicode_subscript(m[1])))
if (m[0] == 't'):
return unicode_art('t⁽{}˴{}⁾'.format(unicode_superscript(m[1][0]), unicode_superscript(m[1][1])))
return unicode_art('E({},{})'.format(m[1][0], m[1][1]))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n The Rank 2 Heisenberg-Virasoro algebra over Rational Field\n '
return 'The Rank 2 Heisenberg-Virasoro algebra over {}'.format(self.base_ring())
@cached_method
def K(self, i=None):
'\n Return the basis element `K_i` of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L.K(1)\n K1\n sage: list(L.K())\n [K1, K2, K3, K4]\n '
if (i is None):
return Family(self._KI, self.K)
return self.monomial(('K', i))
def t(self, a, b):
'\n Return the basis element `t^{(a,b)}` of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L.t(1,-2)\n t(1, -2)\n '
if (a == b == 0):
raise ValueError('no t(0, 0) element')
return self.monomial(('t', self._v(a, b)))
def E(self, a, b):
'\n Return the basis element `E(a,b)` of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L.E(1,-2)\n E(1, -2)\n '
if (a == b == 0):
raise ValueError('no E(0, 0) element')
return self.monomial(('E', self._v(a, b)))
def _v(self, a, b):
'\n Construct an immutable vector ``(a, b)``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: v = L._v(1,2)\n sage: v\n (1, 2)\n sage: v.parent()\n Ambient free module of rank 2 over the principal ideal domain Integer Ring\n sage: hash(v) == hash(v)\n True\n '
ret = self._V((a, b))
ret.set_immutable()
return ret
def bracket_on_basis(self, i, j):
"\n Return the bracket of basis elements indexed by ``i`` and ``j``,\n where ``i < j``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: v = L._v\n sage: L.bracket_on_basis(('K',2), ('t', v(3,-1)))\n 0\n sage: L.bracket_on_basis(('K', 4), ('E', v(3,-1)))\n 0\n sage: L.bracket_on_basis(('t', v(3,-1)), ('t', v(4,3)))\n 0\n sage: L.bracket_on_basis(('t', v(3,-1)), ('E', v(4,3)))\n -13*t(7, 2)\n sage: L.bracket_on_basis(('t', v(2,2)), ('E', v(1,1)))\n 0\n sage: L.bracket_on_basis(('t', v(3,-1)), ('E', v(-3,1)))\n 3*K1 - K2\n sage: L.bracket_on_basis(('E', v(3,-1)), ('E', v(4,3)))\n -13*E(7, 2)\n sage: L.bracket_on_basis(('E', v(2,2)), ('E', v(1,1)))\n 0\n sage: L.bracket_on_basis(('E', v(3,-1)), ('E', v(-3,1)))\n 3*K3 - K4\n "
if ((i[0] == 'K') or (j[0] == 'K')):
return self.zero()
if (i[0] == 't'):
if (j[0] == 't'):
return self.zero()
k = ('t', (i[1] + j[1]))
if (not k[1]):
d = {('K', 1): i[1][0], ('K', 2): i[1][1]}
else:
k[1].set_immutable()
d = {k: ((j[1][0] * i[1][1]) - (j[1][1] * i[1][0]))}
return self._from_dict(d)
k = ('E', (i[1] + j[1]))
if (not k[1]):
d = {('K', 3): i[1][0], ('K', 4): i[1][1]}
else:
k[1].set_immutable()
d = {k: ((j[1][0] * i[1][1]) - (j[1][1] * i[1][0]))}
return self._from_dict(d)
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L.an_element()\n K3 - 1/2*t(-1, 3) + E(1, -3) + E(2, 2)\n '
d = self.monomial
v = self._v
return (((d(('E', v(1, (- 3)))) - (self.base_ring().an_element() * d(('t', v((- 1), 3))))) + d(('E', v(2, 2)))) + d(('K', 3)))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)\n sage: L.some_elements()\n [E(1, 1), E(-2, -2), E(0, 1),\n t(1, 1), t(4, -1), t(2, 3),\n K2, K4,\n K3 - 1/2*t(-1, 3) + E(1, -3) + E(2, 2)]\n '
d = self.monomial
v = self._v
return [d(('E', v(1, 1))), d(('E', v((- 2), (- 2)))), d(('E', v(0, 1))), d(('t', v(1, 1))), d(('t', v(4, (- 1)))), d(('t', v(2, 3))), d(('K', 2)), d(('K', 4)), self.an_element()]
class Element(LieAlgebraElement):
pass
|
class Representation_abstract():
'\n Mixin class for (left) representations of Lie algebras.\n\n INPUT:\n\n - ``lie_algebra`` -- a Lie algebra\n '
def __init__(self, lie_algebra):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: R = L.trivial_representation()\n sage: TestSuite(R).run()\n '
self._lie_algebra = lie_algebra
def lie_algebra(self):
'\n Return the Lie algebra whose representation ``self`` is.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 4)\n sage: R = L.trivial_representation()\n sage: R.lie_algebra() is L\n True\n '
return self._lie_algebra
def side(self):
'\n Return that ``self`` is a left representation.\n\n OUTPUT:\n\n - the string ``"left"``\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 4)\n sage: R = L.trivial_representation()\n sage: R.side()\n \'left\'\n '
return 'left'
def _test_representation(self, **options):
'\n Check (on some elements) that ``self`` is a representation of the\n given Lie algebra using the basis of the Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.Heisenberg(QQ, 3)\n sage: f = {b: b.adjoint_matrix() for b in L.basis()}\n sage: R = L.representation(f)\n sage: R._test_representation()\n '
tester = self._tester(**options)
S = tester.some_elements()
elts = self._lie_algebra.basis()
if (elts.cardinality() == float('inf')):
elts = list(elts.some_elements())
from sage.misc.misc import some_tuples
for (x, y) in some_tuples(elts, 2, tester._max_runs):
for v in S:
tester.assertEqual((x.bracket(y) * v), ((x * (y * v)) - (y * (x * v))))
|
class RepresentationByMorphism(CombinatorialFreeModule, Representation_abstract):
'\n Representation of a Lie algebra defined by a Lie algebra morphism.\n\n INPUT:\n\n - ``lie_algebra`` -- a Lie algebra\n - ``f`` -- the Lie algebra morphism defining the action of the basis\n elements of ``lie_algebra``\n - ``index_set`` -- (optional) the index set of the module basis\n - ``on_basis`` -- (default: ``False``) the function ``f`` defines a\n map from the basis elements or from a generic element of ``lie_algebra``\n\n If ``f`` is encoded as a ``dict`` or ``Family``, then the keys must\n be indices of the basis of ``lie_algebra`` and the values being the\n corresponding matrix defining the action. This sets ``on_basis=True``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {(\'x\',\'y\'): {\'y\':1}})\n sage: f = {x: Matrix([[1,0],[0,0]]), y: Matrix([[0,1],[0,0]])}\n sage: L.representation(f)\n Representation of Lie algebra on 2 generators (x, y) over Rational Field defined by:\n [1 0]\n x |--> [0 0]\n [0 1]\n y |--> [0 0]\n\n We construct the direct sum of two copies of the trivial representation\n for an infinite dimensional Lie algebra::\n\n sage: L = lie_algebras.Affine(QQ, [\'E\',6,1])\n sage: R = L.representation(lambda b: matrix.zero(QQ, 2), index_set=[\'a\',\'b\'])\n sage: x = L.an_element()\n sage: v = R.an_element(); v\n 2*R[\'a\'] + 2*R[\'b\']\n sage: x * v\n 0\n\n We construct a finite dimensional representation of the affline Lie algebra\n of type `A_2^{(1)}`::\n\n sage: L = lie_algebras.Affine(QQ, [\'A\',2,1]).derived_subalgebra()\n sage: Phi_plus = list(RootSystem([\'A\',2]).root_lattice().positive_roots())\n sage: def aff_action(key):\n ....: mat = matrix.zero(QQ, 3)\n ....: if key == \'c\': # central element\n ....: return mat\n ....: b, ell = key\n ....: if b in Phi_plus: # positive root\n ....: ind = tuple(sorted(b.to_ambient().support()))\n ....: mat[ind] = 1\n ....: if ind[0] + 1 != ind[1]:\n ....: mat[ind] = -1\n ....: elif -b in Phi_plus: # negative root\n ....: ind = tuple(sorted(b.to_ambient().support(), reverse=True))\n ....: mat[ind] = 1\n ....: if ind[0] - 1 != ind[1]:\n ....: mat[ind] = -1\n ....: else: # must be in the Cartan\n ....: i = b.leading_support()\n ....: mat[i,i] = -1\n ....: mat[i-1,i-1] = 1\n ....: return mat\n sage: F = Family(L.basis(), aff_action, name="lifted natural repr")\n sage: R = L.representation(index_set=range(1,4), on_basis=F)\n sage: x = L.an_element(); x\n (E[alpha[2]] + E[alpha[1]] + h1 + h2 + E[-alpha[2]] + E[-alpha[1]])#t^0\n + (E[-alpha[1] - alpha[2]])#t^1 + (E[alpha[1] + alpha[2]])#t^-1 + c\n sage: v = R.an_element(); v\n 2*R[1] + 2*R[2] + 3*R[3]\n sage: x * v\n R[1] + 5*R[2] - 3*R[3]\n sage: R._test_representation() # verify that it is a representation\n '
@staticmethod
def __classcall_private__(cls, lie_algebra, f=None, index_set=None, on_basis=False, **kwargs):
"\n Normalize inpute to ensure a unique representation.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'y':1}})\n sage: f1 = {'x': Matrix([[1,0],[0,0]]), 'y': Matrix([[0,1],[0,0]])}\n sage: R1 = L.representation(f1)\n sage: f2 = Family({x: Matrix([[1,0],[0,0]]), y: Matrix(QQ, [[0,1],[0,0]])})\n sage: R2 = L.representation(f2)\n sage: R1 is R2\n True\n\n TESTS::\n\n sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'y':1}})\n sage: f = {'x': Matrix([[1,0]]), 'y': Matrix([[0,1]])}\n sage: L.representation(f)\n Traceback (most recent call last):\n ...\n ValueError: all matrices must be square\n\n sage: f = {'x': Matrix([[1,0],[0,0]]), 'y': Matrix([[0]])}\n sage: L.representation(f)\n Traceback (most recent call last):\n ...\n ValueError: all matrices must be square of size 2\n\n sage: L.representation(index_set=[1,2,3])\n Traceback (most recent call last):\n ...\n ValueError: either 'f' or 'on_basis' must be specified\n sage: L.representation(on_basis=lambda x: QQ.zero())\n Traceback (most recent call last):\n ...\n ValueError: the index set needs to be specified\n "
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
base = lie_algebra.base_ring()
C = Modules(base).WithBasis().FiniteDimensional()
C = C.or_subcategory(kwargs.pop('category', C))
B = lie_algebra.basis()
if (not isinstance(on_basis, bool)):
f = on_basis
on_basis = True
if isinstance(f, AbstractFamily):
if (f.cardinality() < float('inf')):
f = dict(f)
on_basis = True
if isinstance(f, dict):
data = {}
dim = None
for (k, mat) in f.items():
if (k in B):
k = k.leading_support()
if (not mat.is_square()):
raise ValueError('all matrices must be square')
if (dim is None):
dim = mat.nrows()
elif ((mat.nrows() != dim) or (mat.ncols() != dim)):
raise ValueError('all matrices must be square of size {}'.format(dim))
data[k] = mat.change_ring(base)
data[k].set_immutable()
if (index_set is None):
index_set = FiniteEnumeratedSet(range(dim))
f = Family(data)
on_basis = True
if (f is None):
raise ValueError("either 'f' or 'on_basis' must be specified")
if (index_set is None):
raise ValueError('the index set needs to be specified')
index_set = FiniteEnumeratedSet(index_set)
return super(cls, RepresentationByMorphism).__classcall__(cls, lie_algebra, f, index_set, on_basis, category=C, **kwargs)
def __init__(self, lie_algebra, f, index_set, on_basis, category, **kwargs):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'y':1}})\n sage: f = {'x': Matrix([[1,0],[0,0]]), 'y': Matrix([[0,1],[0,0]])}\n sage: R = L.representation(f)\n sage: TestSuite(R).run()\n "
if on_basis:
self._family = f
self._f = f.__getitem__
else:
self._f = f
prefix = kwargs.pop('prefix', 'R')
self._on_basis = on_basis
Representation_abstract.__init__(self, lie_algebra)
CombinatorialFreeModule.__init__(self, lie_algebra.base_ring(), index_set, category=category, prefix=prefix, **kwargs)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {(\'x\',\'y\'): {\'y\':1}})\n sage: f = {\'x\': Matrix([[1,0],[0,0]]), \'y\': Matrix([[0,1],[0,0]])}\n sage: L.representation(f)\n Representation of Lie algebra on 2 generators (x, y) over Rational Field defined by:\n [1 0]\n x |--> [0 0]\n [0 1]\n y |--> [0 0]\n\n sage: L = lie_algebras.Affine(QQ, [\'E\',6,1])\n sage: F = Family(L.basis(), lambda b: matrix.zero(QQ, 2), name="zero map")\n sage: L.representation(F, index_set=[\'a\',\'b\'], on_basis=True)\n Representation of Affine Kac-Moody algebra of [\'E\', 6] in the Chevalley basis defined by:\n Lazy family (zero map(i))_{i in Lazy family...}\n\n sage: L.representation(lambda b: matrix.zero(QQ, 2), index_set=[\'a\',\'b\'])\n Representation of Affine Kac-Moody algebra of [\'E\', 6] in the Chevalley basis defined by:\n <function <lambda> at 0x...>\n '
ret = 'Representation of {} defined by:'.format(self._lie_algebra)
from sage.typeset.ascii_art import ascii_art
if self._on_basis:
B = self._lie_algebra.basis()
if (B.cardinality() < float('inf')):
for k in B.keys():
ret += ('\n' + repr(ascii_art(B[k], self._f(k), sep=' |--> ', sep_baseline=0)))
else:
ret += ('\n' + repr(self._family))
else:
ret += ('\n' + repr(self._f))
return ret
class Element(CombinatorialFreeModule.Element):
def _acted_upon_(self, scalar, self_on_left=False):
'\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, {(\'x\',\'y\'): {\'y\':1}})\n sage: f = {\'x\': Matrix([[1,0],[0,0]]), \'y\': Matrix([[0,1],[0,0]])}\n sage: R = L.representation(f)\n sage: v = R.an_element(); v\n 2*R[0] + 2*R[1]\n sage: x * v\n 2*R[0]\n sage: y * v\n 2*R[0]\n sage: (2*x + 5*y) * v\n 14*R[0]\n sage: v * x\n Traceback (most recent call last):\n ...\n TypeError: unsupported operand parent(s) for *: ...\n\n sage: v = sum((i+4) * b for i, b in enumerate(R.basis())); v\n 4*R[0] + 5*R[1]\n sage: (1/3*x - 5*y) * v\n -71/3*R[0]\n\n sage: L = lie_algebras.Affine(QQ, [\'E\',6,1])\n sage: F = Family(L.basis(), lambda b: matrix.zero(QQ, 2), name="zero map")\n sage: R = L.representation(F, index_set=[\'a\',\'b\'], on_basis=True)\n sage: R.an_element()\n 2*R[\'a\'] + 2*R[\'b\']\n sage: L.an_element() * R.an_element()\n 0\n '
P = self.parent()
if (scalar in P._lie_algebra):
if self_on_left:
return None
if (not self):
return self
scalar = P._lie_algebra(scalar)
if (not scalar):
return P.zero()
if P._on_basis:
mat = sum(((c * P._f(k)) for (k, c) in scalar.monomial_coefficients(copy=False).items()))
else:
mat = P._f(scalar)
return P.from_vector((mat * self.to_vector()))
return super()._acted_upon_(scalar, self_on_left)
|
class TrivialRepresentation(CombinatorialFreeModule, Representation_abstract):
'\n The trivial representation of a Lie algebra.\n\n The trivial representation of a Lie algebra `L` over a commutative ring\n `R` is the `1`-dimensional `R`-module on which every element of `L`\n acts by zero.\n\n INPUT:\n\n - ``lie_algebra`` -- a Lie algebra\n\n REFERENCES:\n\n - :wikipedia:`Trivial_representation`\n '
def __init__(self, lie_algebra, **kwargs):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: R = L.trivial_representation()\n sage: TestSuite(R).run()\n '
R = lie_algebra.base_ring()
cat = Modules(R).WithBasis().FiniteDimensional()
Representation_abstract.__init__(self, lie_algebra)
CombinatorialFreeModule.__init__(self, R, ['v'], prefix='T', category=cat, **kwargs)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: L.trivial_representation()\n Trivial representation of The Virasoro algebra over Rational Field\n '
return 'Trivial representation of {}'.format(self._lie_algebra)
class Element(CombinatorialFreeModule.Element):
def _acted_upon_(self, scalar, self_on_left=False):
"\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: R = L.trivial_representation()\n sage: L.an_element() * R.an_element()\n 0\n sage: R.an_element() * L.an_element()\n Traceback (most recent call last):\n ...\n TypeError: unsupported operand parent(s) for *: ...\n sage: 3 / 5 * R.an_element()\n 6/5*T['v']\n "
P = self.parent()
if (scalar in P._lie_algebra):
if self_on_left:
return None
return P.zero()
return super()._acted_upon_(scalar, self_on_left)
|
class LieAlgebraWithStructureCoefficients(FinitelyGeneratedLieAlgebra, IndexedGenerators):
"\n A Lie algebra with a set of specified structure coefficients.\n\n The structure coefficients are specified as a dictionary `d` whose\n keys are pairs of basis indices, and whose values are\n dictionaries which in turn are indexed by basis indices. The value\n of `d` at a pair `(u, v)` of basis indices is the dictionary whose\n `w`-th entry (for `w` a basis index) is the coefficient of `b_w`\n in the Lie bracket `[b_u, b_v]` (where `b_x` means the basis\n element with index `x`).\n\n INPUT:\n\n - ``R`` -- a ring, to be used as the base ring\n\n - ``s_coeff`` -- a dictionary, indexed by pairs of basis indices\n (see below), and whose values are dictionaries which are\n indexed by (single) basis indices and whose values are elements\n of `R`\n\n - ``names`` -- list or tuple of strings\n\n - ``index_set`` -- (default: ``names``) list or tuple of hashable\n and comparable elements\n\n OUTPUT:\n\n A Lie algebra over ``R`` which (as an `R`-module) is free with\n a basis indexed by the elements of ``index_set``. The `i`-th\n basis element is displayed using the name ``names[i]``.\n If we let `b_i` denote this `i`-th basis element, then the Lie\n bracket is given by the requirement that the `b_k`-coefficient\n of `[b_i, b_j]` is ``s_coeff[(i, j)][k]`` if\n ``s_coeff[(i, j)]`` exists, otherwise ``-s_coeff[(j, i)][k]``\n if ``s_coeff[(j, i)]`` exists, otherwise `0`.\n\n EXAMPLES:\n\n We create the Lie algebra of `\\QQ^3` under the Lie bracket defined\n by `\\times` (cross-product)::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', {('x','y'): {'z':1}, ('y','z'): {'x':1}, ('z','x'): {'y':1}})\n sage: (x,y,z) = L.gens()\n sage: L.bracket(x, y)\n z\n sage: L.bracket(y, x)\n -z\n\n TESTS:\n\n We can input structure coefficients that fail the Jacobi\n identity, but the test suite will call us out on it::\n\n sage: Fake = LieAlgebra(QQ, 'x,y,z', {('x','y'):{'z':3}, ('y','z'):{'z':1}, ('z','x'):{'y':1}})\n sage: TestSuite(Fake).run()\n Failure in _test_jacobi_identity:\n ...\n\n Old tests !!!!!placeholder for now!!!!!::\n\n sage: L = LieAlgebra(QQ, 'x,y', {('x','y'):{'x':1}})\n sage: L.basis()\n Finite family {'x': x, 'y': y}\n "
@staticmethod
def __classcall_private__(cls, R, s_coeff, names=None, index_set=None, **kwds):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: L1 = LieAlgebra(QQ, 'x,y', {('x','y'): {'x':1}})\n sage: L2 = LieAlgebra(QQ, 'x,y', {('y','x'): {'x':-1}})\n sage: L1 is L2\n True\n\n Check that we convert names to the indexing set::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', {('x','y'): {'z':1}, ('y','z'): {'x':1}, ('z','x'): {'y':1}}, index_set=list(range(3)))\n sage: (x,y,z) = L.gens()\n sage: L[x,y]\n L[2]\n "
(names, index_set) = standardize_names_index_set(names, index_set)
if ((names is not None) and (names != tuple(index_set))):
d = {x: index_set[i] for (i, x) in enumerate(names)}
get_pairs = (lambda X: (X.items() if isinstance(X, dict) else X))
try:
s_coeff = {(d[k[0]], d[k[1]]): [(d[x], y) for (x, y) in get_pairs(s_coeff[k])] for k in s_coeff}
except (KeyError, ValueError):
pass
s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff(s_coeff, index_set)
if (s_coeff.cardinality() == 0):
from sage.algebras.lie_algebras.abelian import AbelianLieAlgebra
return AbelianLieAlgebra(R, names, index_set, **kwds)
if (((names is None) and (len(index_set) <= 1)) or (len(names) <= 1)):
from sage.algebras.lie_algebras.abelian import AbelianLieAlgebra
return AbelianLieAlgebra(R, names, index_set, **kwds)
return super().__classcall__(cls, R, s_coeff, names, index_set, **kwds)
@staticmethod
def _standardize_s_coeff(s_coeff, index_set):
"\n Helper function to standardize ``s_coeff`` into the appropriate form\n (dictionary indexed by pairs, whose values are dictionaries).\n Strips items with coefficients of 0 and duplicate entries.\n This does not check the Jacobi relation (nor antisymmetry if the\n cardinality is infinite).\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.structure_coefficients import LieAlgebraWithStructureCoefficients\n sage: d = {('y','x'): {'x':-1}}\n sage: LieAlgebraWithStructureCoefficients._standardize_s_coeff(d, ('x', 'y'))\n Finite family {('x', 'y'): (('x', 1),)}\n "
index_to_pos = {k: i for (i, k) in enumerate(index_set)}
sc = {}
for k in s_coeff.keys():
v = s_coeff[k]
if isinstance(v, dict):
v = v.items()
if (index_to_pos[k[0]] > index_to_pos[k[1]]):
key = (k[1], k[0])
vals = tuple(((g, (- val)) for (g, val) in v if (val != 0)))
else:
if (not (index_to_pos[k[0]] < index_to_pos[k[1]])):
if (k[0] == k[1]):
if (not all(((val == 0) for (g, val) in v))):
raise ValueError('elements {} are equal but their bracket is not set to 0'.format(k))
continue
key = tuple(k)
vals = tuple(((g, val) for (g, val) in v if (val != 0)))
if ((key in sc.keys()) and (sorted(sc[key]) != sorted(vals))):
raise ValueError('two distinct values given for one and the same bracket')
if vals:
sc[key] = vals
return Family(sc)
def __init__(self, R, s_coeff, names, index_set, category=None, prefix=None, bracket=None, latex_bracket=None, string_quotes=None, **kwds):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y', {('x','y'): {'x':1}})\n sage: TestSuite(L).run()\n "
default = (names != tuple(index_set))
if (prefix is None):
if default:
prefix = 'L'
else:
prefix = ''
if (bracket is None):
bracket = default
if (latex_bracket is None):
latex_bracket = default
if (string_quotes is None):
string_quotes = default
self._index_to_pos = {k: i for (i, k) in enumerate(index_set)}
if ('sorting_key' not in kwds):
kwds['sorting_key'] = self._index_to_pos.__getitem__
cat = LieAlgebras(R).WithBasis().FiniteDimensional().or_subcategory(category)
FinitelyGeneratedLieAlgebra.__init__(self, R, names, index_set, cat)
IndexedGenerators.__init__(self, self._indices, prefix=prefix, bracket=bracket, latex_bracket=latex_bracket, string_quotes=string_quotes, **kwds)
self._M = FreeModule(R, len(index_set))
def to_vector(tuples):
vec = ([R.zero()] * len(index_set))
for (k, c) in tuples:
vec[self._index_to_pos[k]] = c
vec = self._M(vec)
vec.set_immutable()
return vec
self._s_coeff = {(self._index_to_pos[k[0]], self._index_to_pos[k[1]]): to_vector(s_coeff[k]) for k in s_coeff.keys()}
_repr_term = IndexedGenerators._repr_generator
_latex_term = IndexedGenerators._latex_generator
def structure_coefficients(self, include_zeros=False):
"\n Return the dictionary of structure coefficients of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y,z', {('x','y'): {'x':1}})\n sage: L.structure_coefficients()\n Finite family {('x', 'y'): x}\n sage: S = L.structure_coefficients(True); S\n Finite family {('x', 'y'): x, ('x', 'z'): 0, ('y', 'z'): 0}\n sage: S['x','z'].parent() is L\n True\n\n TESTS:\n\n Check that :trac:`23373` is fixed::\n\n sage: L = lie_algebras.sl(QQ, 2)\n sage: sorted(L.structure_coefficients(True), key=str)\n [-2*E[-alpha[1]], -2*E[alpha[1]], h1]\n "
if (not include_zeros):
pos_to_index = dict(enumerate(self._indices))
return Family({(pos_to_index[k[0]], pos_to_index[k[1]]): self.element_class(self, self._s_coeff[k]) for k in self._s_coeff})
ret = {}
zero = self._M.zero()
for (i, x) in enumerate(self._indices):
for (j, y) in enumerate(self._indices[(i + 1):]):
if ((i, ((j + i) + 1)) in self._s_coeff):
elt = self._s_coeff[(i, ((j + i) + 1))]
elif ((((j + i) + 1), i) in self._s_coeff):
elt = (- self._s_coeff[(((j + i) + 1), i)])
else:
elt = zero
ret[(x, y)] = self.element_class(self, elt)
return Family(ret)
def dimension(self):
"\n Return the dimension of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, 'x,y', {('x','y'):{'x':1}})\n sage: L.dimension()\n 2\n "
return self.basis().cardinality()
def module(self, sparse=True):
"\n Return ``self`` as a free module.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'):{'z':1}})\n sage: L.module()\n Sparse vector space of dimension 3 over Rational Field\n "
return FreeModule(self.base_ring(), self.dimension(), sparse=sparse)
@cached_method
def zero(self):
"\n Return the element `0` in ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})\n sage: L.zero()\n 0\n "
return self.element_class(self, self._M.zero())
def monomial(self, k):
"\n Return the monomial indexed by ``k``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})\n sage: L.monomial('x')\n x\n "
return self.element_class(self, self._M.basis()[self._index_to_pos[k]])
def term(self, k, c=None):
"\n Return the term indexed by ``i`` with coefficient ``c``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})\n sage: L.term('x', 4)\n 4*x\n "
if (c is None):
c = self.base_ring().one()
else:
c = self.base_ring()(c)
return self.element_class(self, (c * self._M.basis()[self._index_to_pos[k]]))
def from_vector(self, v, order=None, coerce=True):
"\n Return an element of ``self`` from the vector ``v``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})\n sage: L.from_vector([1, 2, -2])\n x + 2*y - 2*z\n "
if coerce:
v = self._M(v)
return self.element_class(self, v)
def _from_dict(self, d, coerce=False, remove_zeros=False):
"\n Construct an element of ``self`` from an ``{index: coefficient}``\n dictionary.\n\n INPUT:\n\n - ``d`` -- a dictionary ``{index: coeff}`` where each ``index`` is the\n index of a basis element and each ``coeff`` belongs to the\n coefficient ring ``self.base_ring()``\n - ``coerce`` -- ignored\n - ``remove_zeros`` -- ignored\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})\n sage: L._from_dict({'x': -3, 'z': 2, 'y': 0})\n -3*x + 2*z\n "
zero = self._M.base_ring().zero()
ret = ([zero] * self._M.rank())
for (k, c) in d.items():
ret[self._index_to_pos[k]] = c
return self.element_class(self, self._M(ret))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.three_dimensional(QQ, 4, 1, -1, 2)\n sage: L.some_elements()\n [X, Y, Z, X + Y + Z]\n '
return (list(self.basis()) + [self.sum(self.basis())])
def change_ring(self, R):
"\n Return a Lie algebra with identical structure coefficients over ``R``.\n\n INPUT:\n\n - ``R`` -- a ring\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(ZZ, {('x','y'): {'z':1}})\n sage: L.structure_coefficients()\n Finite family {('x', 'y'): z}\n sage: LQQ = L.change_ring(QQ)\n sage: LQQ.structure_coefficients()\n Finite family {('x', 'y'): z}\n sage: LSR = LQQ.change_ring(SR) # needs sage.symbolic\n sage: LSR.structure_coefficients() # needs sage.symbolic\n Finite family {('x', 'y'): z}\n "
return LieAlgebraWithStructureCoefficients(R, self.structure_coefficients(), names=self.variable_names(), index_set=self.indices())
class Element(StructureCoefficientsElement):
def _sorted_items_for_printing(self):
'\n Return a list of pairs ``(k, c)`` used in printing.\n\n .. WARNING::\n\n The internal representation order is fixed, whereas this\n depends on ``"sorting_key"`` print option as it is used\n only for printing.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {(\'x\',\'y\'): {\'z\':1}})\n sage: elt = x + y/2 - z; elt\n x + 1/2*y - z\n sage: elt._sorted_items_for_printing()\n [(\'x\', 1), (\'y\', 1/2), (\'z\', -1)]\n sage: key = {\'x\': 2, \'y\': 1, \'z\': 0}\n sage: L.print_options(sorting_key=key.__getitem__)\n sage: elt._sorted_items_for_printing()\n [(\'z\', -1), (\'y\', 1/2), (\'x\', 1)]\n sage: elt\n -z + 1/2*y + x\n '
print_options = self.parent().print_options()
pos_to_index = dict(enumerate(self.parent()._indices))
v = [(pos_to_index[k], c) for (k, c) in self.value.items()]
try:
v.sort(key=(lambda monomial_coeff: print_options['sorting_key'](monomial_coeff[0])), reverse=print_options['sorting_reverse'])
except Exception:
pass
return v
|
class LieSubalgebra_finite_dimensional_with_basis(Parent, UniqueRepresentation):
"\n A Lie subalgebra of a finite dimensional Lie algebra with basis.\n\n INPUT:\n\n - ``ambient`` -- the Lie algebra containing the subalgebra\n - ``gens`` -- a list of generators of the subalgebra\n - ``ideal`` -- (default: ``False``) a boolean; if ``True``, then ``gens``\n is interpreted as the generating set of an ideal instead of a subalgebra\n - ``order`` -- (optional) the key used to sort the indices of ``ambient``\n - ``category`` -- (optional) a subcategory of subobjects of finite\n dimensional Lie algebras with basis\n\n EXAMPLES:\n\n Subalgebras and ideals are defined by giving a list of generators::\n\n sage: L = lie_algebras.Heisenberg(QQ, 1)\n sage: X, Y, Z = L.basis()\n sage: S = L.subalgebra([X, Z]); S\n Subalgebra generated by (p1, z) of Heisenberg algebra of rank 1 over Rational Field\n sage: I = L.ideal([X, Z]); I\n Ideal (p1, z) of Heisenberg algebra of rank 1 over Rational Field\n\n An ideal is in general larger than the subalgebra with the same generators::\n\n sage: S = L.subalgebra(Y)\n sage: S.basis()\n Family (q1,)\n sage: I = L.ideal(Y)\n sage: I.basis()\n Family (q1, z)\n\n The zero dimensional subalgebra can be created by giving 0 as a generator\n or with an empty list of generators::\n\n sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}})\n sage: S1 = L.subalgebra(0)\n sage: S2 = L.subalgebra([])\n sage: S1 is S2\n True\n sage: S1.basis()\n Family ()\n\n Elements of the ambient Lie algebra can be reduced modulo an\n ideal or subalgebra::\n\n sage: # needs sage.symbolic\n sage: L.<X,Y,Z> = LieAlgebra(SR, {('X','Y'): {'Z': 1}})\n sage: I = L.ideal(Y)\n sage: I.reduce(X + 2*Y + 3*Z)\n X\n sage: S = L.subalgebra(Y)\n sage: S.reduce(X + 2*Y + 3*Z)\n X + 3*Z\n\n The reduction gives elements in a fixed complementary subspace.\n When the base ring is a field, the complementary subspace is spanned by\n those basis elements which are not leading supports of the basis::\n\n sage: # needs sage.symbolic\n sage: I = L.ideal(X + Y)\n sage: I.basis()\n Family (X + Y, Z)\n sage: el = var('x')*X + var('y')*Y + var('z')*Z; el\n x*X + y*Y + z*Z\n sage: I.reduce(el)\n (x-y)*X\n\n Giving a different ``order`` may change the reduction of elements::\n\n sage: I = L.ideal(X + Y, order=lambda s: ['Z','Y','X'].index(s)) # needs sage.symbolic\n sage: I.basis() # needs sage.symbolic\n Family (Z, X + Y)\n sage: I.reduce(el) # needs sage.symbolic\n (-x+y)*Y\n\n A subalgebra of a subalgebra is a subalgebra of the original::\n\n sage: sc = {('X','Y'): {'Z': 1}, ('X','Z'): {'W': 1}}\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, sc)\n sage: S1 = L.subalgebra([Y, Z, W]); S1\n Subalgebra generated by (Y, Z, W) of Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: S2 = S1.subalgebra(S1.gens()[1:]); S2\n Subalgebra generated by (Z, W) of Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: S3 = S2.subalgebra(S2.gens()[1:]); S3\n Subalgebra generated by (W) of Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n\n An ideal of an ideal is not necessarily an ideal of the original::\n\n sage: I = L.ideal(Y); I\n Ideal (Y) of Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: J = I.ideal(Z); J\n Ideal (Z) of Ideal (Y) of Lie algebra on 4 generators (X, Y, Z, W) over Rational Field\n sage: J.basis()\n Family (Z,)\n sage: J.is_ideal(L)\n False\n sage: K = L.ideal(J.basis().list())\n sage: K.basis()\n Family (Z, W)\n\n TESTS:\n\n Test suites::\n\n sage: S = L.subalgebra(X + Y)\n sage: TestSuite(S).run()\n sage: I = L.ideal(X + Y)\n sage: TestSuite(I).run()\n\n Verify that subalgebras and ideals of nilpotent Lie algebras are nilpotent::\n\n sage: L = LieAlgebra(QQ, 3, step=4)\n sage: x,y,z = L.homogeneous_component_basis(1)\n sage: S = L.subalgebra([x, y])\n sage: S in LieAlgebras(QQ).Nilpotent()\n True\n sage: S.step()\n 4\n sage: I = L.ideal(z)\n sage: I in LieAlgebras(QQ).Nilpotent()\n True\n sage: I.step()\n 3\n\n Test computation for a nested ideal::\n\n sage: sc = {('X','Y'): {'Z': 1}, ('X','Z'): {'W': 1}}\n sage: L.<X,Y,Z,W> = LieAlgebra(QQ, sc)\n sage: I = L.ideal(Y)\n sage: J = I.ideal(Z)\n sage: J.reduce(I(Z) + I(W))\n W\n "
@staticmethod
def __classcall_private__(cls, ambient, gens, ideal=False, order=None, category=None):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES:\n\n Various ways to input one generator::\n\n sage: L.<X,Y> = LieAlgebra(QQ, {('X','Y'): {'X': 1}})\n sage: S1 = L.subalgebra(X)\n sage: S2 = L.subalgebra((X,))\n sage: S3 = L.subalgebra([X])\n sage: S1 is S2 and S2 is S3\n True\n\n Zero generators are ignored::\n\n sage: S1 = L.subalgebra(X)\n sage: S2 = L.subalgebra((X, 0))\n sage: S3 = L.subalgebra([X, 0, 0])\n sage: S1 is S2 and S2 is S3\n True\n sage: T1 = L.subalgebra(0)\n sage: T2 = L.subalgebra([])\n sage: T3 = L.subalgebra([0, 0])\n sage: T1 is T2 and T2 is T3\n True\n "
if (not isinstance(gens, (list, tuple))):
gens = [gens]
gens = tuple((ambient(gen) for gen in gens if (not gen.is_zero())))
if ((not ideal) and isinstance(ambient, LieSubalgebra_finite_dimensional_with_basis)):
gens = tuple((ambient.lift(gen) for gen in gens))
ambient = ambient.ambient()
cat = LieAlgebras(ambient.base_ring()).FiniteDimensional().WithBasis()
category = cat.Subobjects().or_subcategory(category)
if (ambient in LieAlgebras(ambient.base_ring()).Nilpotent()):
category = category.Nilpotent()
return super().__classcall__(cls, ambient, gens, ideal, order, category)
def __init__(self, ambient, gens, ideal, order=None, category=None):
"\n Initialize ``self``.\n\n TESTS::\n\n sage: L.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}})\n sage: S = L.subalgebra(X)\n sage: TestSuite(S).run()\n sage: I = L.ideal(X)\n sage: TestSuite(I).run()\n\n Check that :trac:`34006` is fixed::\n\n sage: S.gens()[0].parent() is S\n True\n "
self._ambient = ambient
self._is_ideal = ideal
if (order is None):
if hasattr(ambient, '_basis_key'):
order = ambient._basis_key
else:
order = (lambda x: x)
self._order = order
self._reversed_indices = sorted(ambient.indices(), key=order, reverse=True)
self._reorganized_indices = [self._reversed_indices.index(i) for i in ambient.indices()]
super().__init__(ambient.base_ring(), category=category)
self._gens = tuple([self.element_class(self, g) for g in gens])
H = Hom(self, ambient)
f = SetMorphism(H, self.lift)
ambient.register_coercion(f)
def __contains__(self, x):
"\n Return ``True`` if ``x`` is an element of ``self``.\n\n EXAMPLES:\n\n Elements of the ambient Lie algebra are contained in the subalgebra\n if they are iterated brackets of the generators::\n\n sage: sc = {('x','y'): {'z': 1}, ('x','z'): {'w': 1}}\n sage: L.<x,y,z,w,u> = LieAlgebra(QQ, sc)\n sage: S = L.subalgebra([x, y])\n sage: z in S\n True\n sage: w in S\n True\n sage: u in S\n False\n\n TESTS::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: I = L.subalgebra(x)\n sage: I(x) in I\n True\n\n "
if (x in self.ambient()):
x = self.ambient()(x)
return (x.to_vector() in self.module())
return super().__contains__(x)
def __getitem__(self, x):
"\n If `x` is a pair `(a, b)`, return the Lie bracket `[a, b]`.\n Otherwise try to return the `x`-th element of ``self``.\n\n This replicates the convenience syntax for Lie brackets of Lie algebras.\n\n EXAMPLES::\n\n sage: L.<x,y, z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: S = L.subalgebra([x, y])\n sage: a = S(x); b = S(y)\n sage: S[a, b]\n z\n sage: S[a, a + S[a,b]]\n 0\n "
if (isinstance(x, tuple) and (len(x) == 2)):
return self(x[0])._bracket_(self(x[1]))
return super().__getitem__(x)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L.<X,Y> = LieAlgebra(QQ, abelian=True)\n sage: L.subalgebra([X, Y])\n Subalgebra generated by (X, Y) of Abelian Lie algebra on 2 generators (X, Y) over Rational Field\n sage: L.ideal([X, Y])\n Ideal (X, Y) of Abelian Lie algebra on 2 generators (X, Y) over Rational Field\n '
gens = self.gens()
if (len(gens) == 1):
gens = gens[0]
if self._is_ideal:
basestr = 'Ideal'
else:
basestr = 'Subalgebra generated by'
return ('%s %s of %s' % (basestr, self._repr_short(), self.ambient()))
def _repr_short(self):
"\n Represent the list of generators.\n\n EXAMPLES::\n\n sage: L.<X,Y> = LieAlgebra(QQ, abelian=True)\n sage: L.ideal([X, Y])._repr_short()\n '(X, Y)'\n sage: L.ideal(X)._repr_short()\n '(X)'\n sage: L.subalgebra(X)._repr_short()\n '(X)'\n "
return ('(%s)' % ', '.join((str(X) for X in self.gens())))
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L.<X,Y> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra([X, Y])\n sage: S._an_element_()\n X\n '
return self.element_class(self, self.lie_algebra_generators()[0])
def _element_constructor_(self, x):
"\n Convert ``x`` into ``self``.\n\n EXAMPLES:\n\n Elements of subalgebras are created directly from elements\n of the ambient Lie algebra::\n\n sage: L.<x,y,z,w> = LieAlgebra(ZZ, {('x','y'): {'z': 1}})\n sage: S = L.subalgebra([x, y])\n sage: S(y)\n y\n sage: S(y).parent()\n Subalgebra generated by (x, y) of Lie algebra on 4 generators (x, y, z, w) over Integer Ring\n\n A vector contained in the module corresponding to the subalgebra is\n interpreted as a coordinate vector::\n\n sage: S.module()\n Free module of degree 4 and rank 3 over Integer Ring\n User basis matrix:\n [1 0 0 0]\n [0 1 0 0]\n [0 0 1 0]\n sage: S(vector(ZZ, [2, 3, 5, 0]))\n 2*x + 3*y + 5*z\n\n A list of 2 elements is interpreted as a Lie bracket::\n\n sage: S([S(x), S(y)])\n z\n sage: S([S(x), S(y)]) == S(L[x, y])\n True\n "
try:
P = x.parent()
if (P is self):
return x
if (P == self.ambient()):
return self.retract(x)
except AttributeError:
pass
if (x in self.module()):
return self.from_vector(x)
if (isinstance(x, list) and (len(x) == 2)):
return self(x[0])._bracket_(self(x[1]))
return super()._element_constructor_(x)
def _to_m(self, X):
"\n Return the vector of an element of the ambient Lie algebra with indices\n reorganized in decreasing order according to ``self._order``.\n\n This is used internally for submodule computations, so that the pivot\n elements in the echelon form are given by\n :meth:`~sage.categories.modules_with_basis.ModulesWithBasis.ElementMethods.leading_term`\n using the sort key ``self._order``.\n\n INPUT:\n\n - ``X`` -- an element of the ambient Lie algebra\n\n EXAMPLES:\n\n If the basis is in increasing order, it is reversed::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: I = L.ideal([x, z])\n sage: el = x + 2*y + 3*z\n sage: el.to_vector()\n (1, 2, 3)\n sage: I._to_m(el)\n (3, 2, 1)\n\n This follows the reverse order of the ambient basis order::\n\n sage: L.<x,z,y> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: I = L.ideal([x, z])\n sage: el = x + 2*y + 3*z\n sage: el.to_vector()\n (1, 3, 2)\n sage: I._to_m(el)\n (2, 3, 1)\n "
mc = X.monomial_coefficients()
M = self.ambient().module()
R = M.base_ring()
B = M.basis()
return M.sum(((R(mc[self._reversed_indices[i]]) * B[i]) for i in range(len(B)) if (self._reversed_indices[i] in mc)))
def _from_m(self, v):
"\n Return the element of the ambient Lie algebra from a reorganized vector.\n\n This is used internally for submodule computations, so that the pivot\n elements in the echelon form are given by\n :meth:`~sage.categories.modules_with_basis.ModulesWithBasis.ElementMethods.leading_term`\n using the sort key `self._order`.\n\n INPUT:\n\n - ``v`` -- a vector\n\n EXAMPLES:\n\n Unscrambling of a vector when the basis is in increasing order::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: I = L.ideal([x, z])\n sage: I._from_m([3, 2, 1])\n x + 2*y + 3*z\n\n The map is the inverse of :meth:`_to_m`::\n\n sage: L.<c,a,e,f,b,d> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra(L.basis().list())\n sage: v = S._to_m(c + 2*a + 3*e + 4*f + 5*b + 6*d); v\n (6, 5, 4, 3, 2, 1)\n sage: S._from_m(v)\n c + 2*a + 3*e + 4*f + 5*b + 6*d\n sage: all(S._from_m(S._to_m(X)) == X for X in L.some_elements())\n True\n "
L = self.ambient()
M = L.module()
R = M.base_ring()
v_self = M.coordinate_vector(v)
B = M.basis()
v_sorted = M.sum(((R(v_self[self._reorganized_indices[i]]) * B[i]) for i in range(len(B))))
return L.from_vector(v_sorted)
@lazy_attribute
def _indices(self):
'\n Return the set of indices for the basis of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra([x, y])\n sage: S._indices\n {0, 1}\n sage: [S.basis()[k] for k in S._indices]\n [x, y]\n '
return FiniteEnumeratedSet(self.basis().keys())
def indices(self):
'\n Return the set of indices for the basis of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra([x, y])\n sage: S.indices()\n {0, 1}\n sage: [S.basis()[k] for k in S.indices()]\n [x, y]\n '
return self._indices
@cached_method
def zero(self):
'\n Return the element `0`.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra(x)\n sage: S.zero()\n 0\n sage: S.zero() == S(L.zero())\n True\n '
return self.element_class(self, self.ambient().zero())
def ambient(self):
'\n Return the ambient Lie algebra of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra(x)\n sage: S.ambient() is L\n True\n '
return self._ambient
def lift(self, X):
'\n Coerce an element ``X`` of ``self`` into the ambient Lie algebra.\n\n INPUT:\n\n - ``X`` -- an element of ``self``\n\n EXAMPLES::\n\n sage: L.<x,y> = LieAlgebra(QQ, abelian=True)\n sage: S = L.subalgebra(x)\n sage: sx = S(x); sx\n x\n sage: sx.parent()\n Subalgebra generated by (x) of Abelian Lie algebra on 2 generators (x, y) over Rational Field\n sage: a = S.lift(sx); a\n x\n sage: a.parent()\n Abelian Lie algebra on 2 generators (x, y) over Rational Field\n '
return X.value
def retract(self, X):
'\n Retract ``X`` to ``self``.\n\n INPUT:\n\n - ``X`` -- an element of the ambient Lie algebra\n\n EXAMPLES:\n\n Retraction to a subalgebra of a free nilpotent Lie algebra::\n\n sage: L = LieAlgebra(QQ, 3, step=2)\n sage: L.inject_variables()\n Defining X_1, X_2, X_3, X_12, X_13, X_23\n sage: S = L.subalgebra([X_1, X_2])\n sage: el = S.retract(2*X_1 + 3*X_2 + 5*X_12); el\n 2*X_1 + 3*X_2 + 5*X_12\n sage: el.parent()\n Subalgebra generated by (X_1, X_2) of Free Nilpotent Lie algebra on\n 6 generators (X_1, X_2, X_3, X_12, X_13, X_23) over Rational Field\n\n Retraction raises an error if the element is not contained in the\n subalgebra::\n\n sage: S.retract(X_3)\n Traceback (most recent call last):\n ...\n ValueError: the element X_3 is not in Subalgebra generated\n by (X_1, X_2) of Free Nilpotent Lie algebra on 6 generators\n (X_1, X_2, X_3, X_12, X_13, X_23) over Rational Field\n '
if (X not in self):
raise ValueError(('the element %s is not in %s' % (X, self)))
return self.element_class(self, X)
def gens(self):
"\n Return the generating set of ``self``.\n\n EXAMPLES::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: S = L.subalgebra(x)\n sage: S.gens()\n (x,)\n "
return self._gens
def lie_algebra_generators(self):
"\n Return the generating set of ``self`` as a Lie algebra.\n\n EXAMPLES:\n\n The Lie algebra generators of a subalgebra are the original generators::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: S = L.subalgebra(x)\n sage: S.lie_algebra_generators()\n (x,)\n\n The Lie algebra generators of an ideal is usually a larger set::\n\n sage: I = L.ideal(x)\n sage: I.lie_algebra_generators()\n Family (x, z)\n "
if self._is_ideal:
return self.basis()
return self._gens
@cached_method
def basis(self):
"\n Return a basis of ``self``.\n\n EXAMPLES:\n\n A basis of a subalgebra::\n\n sage: sc = {('a','b'): {'c': 1}, ('a','c'): {'d': 1}}\n sage: L.<a,b,c,d> = LieAlgebra(QQ, sc)\n sage: L.subalgebra([a + b, c + d]).basis()\n Family (a + b, c, d)\n\n A basis of an ideal::\n\n sage: sc = {('x','y'): {'z': 1}, ('x','z'): {'w': 1}}\n sage: L.<x,y,z,w> = LieAlgebra(QQ, sc)\n sage: L.ideal([x + y + z + w]).basis()\n Family (x + y, z, w)\n\n This also works for Lie algebras whose natural basis elements\n are not comparable (but have a well-defined basis ordering)::\n\n sage: sl3 = LieAlgebra(QQ, cartan_type=['A',2])\n sage: D = sl3.derived_subalgebra()\n sage: len(D.basis())\n 8\n sage: e = list(sl3.e())\n sage: sl3.ideal(e).dimension()\n 8\n sage: sl3.subalgebra(e).dimension()\n 3\n "
L = self.ambient()
B = [self._to_m(X) for X in L.basis()]
m = L.module()
sm = m.submodule([self._to_m(X.value) for X in self.gens()])
d = 0
while (sm.dimension() > d):
d = sm.dimension()
SB = sm.basis()
if (not self._is_ideal):
B = SB
brackets = [self._to_m(L.bracket(self._from_m(v), self._from_m(w))) for v in B for w in SB]
sm = m.submodule((sm.basis() + brackets))
basis = [self.element_class(self, self._from_m(v)) for v in sm.echelonized_basis()]
sortkey = (lambda X: self._order(self.lift(X).leading_support(key=self._order)))
return Family(sorted(basis, key=sortkey))
@cached_method
def leading_monomials(self):
"\n Return the set of leading monomials of the basis of ``self``.\n\n EXAMPLES:\n\n A basis of an ideal and the corresponding leading monomials::\n\n sage: sc = {('a','b'): {'c': 2}, ('a','c'): {'d': 4}}\n sage: L.<a,b,c,d> = LieAlgebra(ZZ, sc)\n sage: I = L.ideal(a + b)\n sage: I.basis()\n Family (a + b, 2*c, 4*d)\n sage: I.leading_monomials()\n Family (b, c, d)\n\n A different ordering can give different leading monomials::\n\n sage: key = lambda s: ['d','c','b','a'].index(s)\n sage: I = L.ideal(a + b, order=key)\n sage: I.basis()\n Family (4*d, 2*c, a + b)\n sage: I.leading_monomials()\n Family (d, c, a)\n "
return Family((self.lift(X).leading_monomial(key=self._order) for X in self.basis()))
def from_vector(self, v, order=None, coerce=False):
'\n Return the element of ``self`` corresponding to the vector ``v``\n\n INPUT:\n\n - ``v`` -- a vector in ``self.module()`` or ``self.ambient().module()``\n\n EXAMPLES:\n\n An element from a vector of the intrinsic module::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, abelian=True)\n sage: L.dimension()\n 3\n sage: S = L.subalgebra([X, Y])\n sage: S.dimension()\n 2\n sage: el = S.from_vector([1, 2]); el\n X + 2*Y\n sage: el.parent() == S\n True\n\n An element from a vector of the ambient module\n\n sage: el = S.from_vector([1, 2, 0]); el\n X + 2*Y\n sage: el.parent() == S\n True\n '
if (len(v) == self.ambient().dimension()):
return self.retract(self.ambient().from_vector(v))
return super().from_vector(v)
def basis_matrix(self):
"\n Return the basis matrix of ``self`` as a submodule\n of the ambient Lie algebra.\n\n EXAMPLES::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})\n sage: S1 = L.subalgebra([4*X + Y, Y])\n sage: S1.basis_matrix()\n [ 4 0 0]\n [ 0 1 0]\n [ 0 0 12]\n sage: K.<X,Y,Z> = LieAlgebra(QQ, {('X','Y'): {'Z': 3}})\n sage: S2 = K.subalgebra([4*X + Y, Y])\n sage: S2.basis_matrix()\n [1 0 0]\n [0 1 0]\n [0 0 1]\n "
return self.module().basis_matrix()
@cached_method
def module(self, sparse=False):
"\n Return the submodule of the ambient Lie algebra\n corresponding to ``self``.\n\n EXAMPLES::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})\n sage: S = L.subalgebra([X, Y])\n sage: S.module()\n Free module of degree 3 and rank 3 over Integer Ring\n User basis matrix:\n [1 0 0]\n [0 1 0]\n [0 0 3]\n "
try:
m = self.ambient().module(sparse=sparse)
except TypeError:
m = self.ambient().module()
ambientbasis = [self.lift(X).to_vector() for X in self.basis()]
return m.submodule_with_basis(ambientbasis)
@cached_method
def is_ideal(self, A):
"\n Return if ``self`` is an ideal of ``A``.\n\n EXAMPLES:\n\n Some subalgebras are ideals::\n\n sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z': 1}})\n sage: S1 = L.subalgebra([x])\n sage: S1.is_ideal(L)\n False\n sage: S2 = L.subalgebra([x, y])\n sage: S2.is_ideal(L)\n True\n sage: S3 = L.subalgebra([y, z])\n sage: S3.is_ideal(L)\n True\n\n All ideals are ideals::\n\n sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x': 1}})\n sage: I = L.ideal(x)\n sage: I.is_ideal(L)\n True\n sage: I.is_ideal(I)\n True\n\n TESTS::\n\n sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x': 1}})\n sage: I = L.ideal(x)\n sage: L.is_ideal(I)\n False\n "
if ((A == self.ambient()) and self._is_ideal):
return True
return super().is_ideal(A)
def reduce(self, X):
"\n Reduce an element of the ambient Lie algebra modulo the\n ideal ``self``.\n\n INPUT:\n\n - ``X`` -- an element of the ambient Lie algebra\n\n OUTPUT:\n\n An element `Y` of the ambient Lie algebra that is contained in a fixed\n complementary submodule `V` to ``self`` such that `X = Y` mod ``self``.\n\n When the base ring of ``self`` is a field, the complementary submodule\n `V` is spanned by the elements of the basis that are not the leading\n supports of the basis of ``self``.\n\n EXAMPLES:\n\n An example reduction in a 6 dimensional Lie algebra::\n\n sage: sc = {('a','b'): {'d': 1}, ('a','c'): {'e': 1},\n ....: ('b','c'): {'f': 1}}\n sage: L.<a,b,c,d,e,f> = LieAlgebra(QQ, sc)\n sage: I = L.ideal(c)\n sage: I.reduce(a + b + c + d + e + f)\n a + b + d\n\n The reduction of an element is zero if and only if the\n element belongs to the subalgebra::\n\n sage: I.reduce(c + e)\n 0\n sage: c + e in I\n True\n\n Over non-fields, the complementary submodule may not be spanned by\n a subset of the basis of the ambient Lie algebra::\n\n sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})\n sage: I = L.ideal(Y)\n sage: I.basis()\n Family (Y, 3*Z)\n sage: I.reduce(3*Z)\n 0\n sage: I.reduce(Y + 14*Z)\n 2*Z\n "
R = self.base_ring()
for Y in self.basis():
Y = self.lift(Y)
(k, c) = Y.leading_item(key=self._order)
if R.is_field():
X = (X - ((X[k] / c) * Y))
else:
try:
(q, _) = X[k].quo_rem(c)
X = (X - (q * Y))
except AttributeError:
pass
return X
class Element(LieSubalgebraElementWrapper):
def adjoint_matrix(self, sparse=False):
'\n Return the matrix of the adjoint action of ``self``.\n\n EXAMPLES::\n\n sage: MS = MatrixSpace(QQ, 2)\n sage: m = MS([[0, -1], [1, 0]])\n sage: L = LieAlgebra(associative=MS)\n sage: S = L.subalgebra([m])\n sage: x = S.basis()[0]\n sage: x.parent() is S\n True\n sage: x.adjoint_matrix()\n [0]\n\n sage: m1 = MS([[0, 1], [0, 0]])\n sage: m2 = MS([[0, 0], [1, 0]])\n sage: S = L.subalgebra([m1, m2])\n sage: e,f = S.lie_algebra_generators()\n sage: ascii_art([b.value.value for b in S.basis()])\n [ [0 1] [0 0] [-1 0] ]\n [ [0 0], [1 0], [ 0 1] ]\n sage: E = e.adjoint_matrix(); E\n [ 0 0 2]\n [ 0 0 0]\n [ 0 -1 0]\n sage: F = f.adjoint_matrix(); F\n [ 0 0 0]\n [ 0 0 -2]\n [ 1 0 0]\n sage: h = e.bracket(f)\n sage: E * F - F * E == h.adjoint_matrix()\n True\n\n TESTS:\n\n Check that :trac:`34006` is fixed::\n\n sage: MS = MatrixSpace(QQ, 2)\n sage: m = MS([[0, -1], [1, 0]])\n sage: L = LieAlgebra(associative=MS)\n sage: S = L.subalgebra([m])\n sage: S.killing_form_matrix()\n [0]\n '
P = self.parent()
basis = P.basis()
M = P.module(sparse=sparse)
return matrix(self.base_ring(), [M.coordinate_vector(P.bracket(self, b).to_vector(sparse=sparse)) for b in basis], sparse=sparse).transpose()
|
class SymplecticDerivationLieAlgebra(InfinitelyGeneratedLieAlgebra, IndexedGenerators):
'\n The symplectic derivation Lie algebra.\n\n Fix a `g \\geq 4` and let `R` be a commutative ring. Let `H = R^{2g}`\n be equipped with a symplectic form `\\mu` with the basis\n `a_1, \\ldots, a_g, b_1, \\ldots, b_g` such that\n\n .. MATH::\n\n \\mu(a_i, a_j) = \\mu(b_i, b_j) = 0,\n \\qquad\\qquad\n \\mu(a_i, b_j) = -\\mu(b_j, a_i) = \\delta_{ij},\n\n for all `i, j`. The *symplectic derivation Lie algebra* is the Lie\n algebra\n\n .. MATH::\n\n \\mathfrak{c}_g := \\bigoplus_{w \\geq 0} S^{w+2} H\n\n with the Lie bracket on basis elements\n\n .. MATH::\n\n [x_1 \\cdots x_{m+2}, y_1 \\cdots y_{n+2}] =\n \\sum_{i,j} \\mu(x_i, y_j) x_1 \\cdots \\widehat{x}_i \\cdots x_{m+2}\n \\cdot y_1 \\cdots \\widehat{y}_j \\cdots y_{n+2},\n\n where `\\widehat{z}` denotes that factor is missing. When `R = \\QQ`, this\n corresponds to the classical Poisson bracket on `C^{\\infty}(\\RR^{2g})`\n restricted to polynomials with coefficients in `\\QQ`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: elts = L.some_elements()\n sage: list(elts)\n [a1*a2, b1*b3, a1*a1*a2, b3*b4,\n a1*a4*b3, a1*a2 - 1/2*a1*a2*a2*a5 + a1*a1*a2*b1*b4]\n sage: [[elts[i].bracket(elts[j]) for i in range(len(elts))]\n ....: for j in range(len(elts))]\n [[0, -a2*b3, 0, 0, 0, -a1*a1*a2*a2*b4],\n [a2*b3, 0, 2*a1*a2*b3, 0, a4*b3*b3, a2*b3 - 1/2*a2*a2*a5*b3 + 2*a1*a2*b1*b3*b4],\n [0, -2*a1*a2*b3, 0, 0, 0, -2*a1*a1*a1*a2*a2*b4],\n [0, 0, 0, 0, a1*b3*b3, 0],\n [0, -a4*b3*b3, 0, -a1*b3*b3, 0, -a1*a1*a1*a2*b1*b3 - a1*a1*a2*a4*b3*b4],\n [a1*a1*a2*a2*b4, -a2*b3 + 1/2*a2*a2*a5*b3 - 2*a1*a2*b1*b3*b4, 2*a1*a1*a1*a2*a2*b4,\n 0, a1*a1*a1*a2*b1*b3 + a1*a1*a2*a4*b3*b4, 0]]\n sage: x = L.monomial(Partition([8,8,6,6,4,2,2,1,1,1])); x\n a1*a1*a1*a2*a2*a4*b1*b1*b3*b3\n sage: [L[x, elt] for elt in elts]\n [-2*a1*a1*a1*a2*a2*a2*a4*b1*b3*b3,\n 3*a1*a1*a2*a2*a4*b1*b1*b3*b3*b3,\n -4*a1*a1*a1*a1*a2*a2*a2*a4*b1*b3*b3,\n a1*a1*a1*a2*a2*b1*b1*b3*b3*b3,\n -2*a1*a1*a1*a2*a2*a4*a4*b1*b3*b3*b3,\n -2*a1*a1*a1*a2*a2*a2*a4*b1*b3*b3 + a1*a1*a1*a2*a2*a2*a2*a4*a5*b1*b3*b3\n + a1*a1*a1*a1*a1*a2*a2*a2*b1*b1*b1*b3*b3 - a1*a1*a1*a1*a2*a2*a2*a4*b1*b1*b3*b3*b4]\n\n REFERENCES:\n\n - [Harako2020]_\n '
def __init__(self, R, g):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: TestSuite(L).run()\n '
if (g < 4):
raise ValueError('g must be at least 4')
cat = LieAlgebras(R).WithBasis().Graded()
self._g = g
d = Family(NonNegativeIntegers(), (lambda n: Partitions(n, min_length=2, max_part=(2 * g))))
indices = DisjointUnionEnumeratedSets(d)
InfinitelyGeneratedLieAlgebra.__init__(self, R, index_set=indices, category=cat)
IndexedGenerators.__init__(self, indices, sorting_key=self._basis_key)
def _basis_key(self, x):
'\n Return the key used to compare two basis element indices.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L._basis_key( [7, 5, 2, 1] )\n (4, [7, 5, 2, 1])\n\n sage: x = L.an_element(); x\n a1*a2 - 1/2*a1*a2*a2*a5 + a1*a1*a2*b1*b4\n sage: sorted(map(L._basis_key, x.support()))\n [(2, [2, 1]), (4, [5, 2, 2, 1]), (5, [9, 6, 2, 1, 1])]\n '
return (len(x), x)
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L._repr_term([7, 5, 2, 1])\n 'a1*a2*a5*b2'\n "
g = self._g
def label(i):
return ('a{}'.format(i) if (i <= g) else 'b{}'.format((i - g)))
return '*'.join((label(i) for i in reversed(m)))
def _latex_term(self, m):
"\n Return a `\\LaTeX` representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L._latex_term([7, 5, 2, 1])\n 'a_{1} a_{2} a_{5} b_{2}'\n "
g = self._g
def label(i):
return ('a_{{{}}}'.format(i) if (i <= g) else 'b_{{{}}}'.format((i - g)))
return ' '.join((label(i) for i in reversed(m)))
def _unicode_art_term(self, m):
'\n Return a unicode art representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L._unicode_art_term([7, 5, 2, 1])\n a₁·a₂·a₅·b₂\n '
from sage.typeset.unicode_art import unicode_art, unicode_subscript
g = self._g
def label(i):
return ('a{}'.format(unicode_subscript(i)) if (i <= g) else 'b{}'.format(unicode_subscript((i - g))))
return unicode_art('·'.join((label(i) for i in reversed(m))))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.SymplecticDerivation(QQ, 5)\n Symplectic derivation Lie algebra of rank 5 over Rational Field\n '
return 'Symplectic derivation Lie algebra of rank {} over {}'.format(self._g, self.base_ring())
def degree_on_basis(self, x):
'\n Return the degree of the basis element indexed by ``x``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L.degree_on_basis([5,2,1])\n 1\n sage: L.degree_on_basis([1,1])\n 0\n sage: elt = L.monomial(Partition([5,5,2,1])) + 3*L.monomial(Partition([3,3,2,1]))\n sage: elt.degree()\n 2\n '
return (len(x) - 2)
def bracket_on_basis(self, x, y):
'\n Return the bracket of basis elements indexed by ``x`` and ``y``,\n where ``i < j``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L.bracket_on_basis([5,2,1], [5,1,1])\n 0\n sage: L.bracket_on_basis([6,1], [3,1,1])\n -2*a1*a1*a3\n sage: L.bracket_on_basis([9,2,1], [4,1,1])\n -a1*a1*a1*a2\n sage: L.bracket_on_basis([5,5,2], [6,1,1])\n 0\n sage: L.bracket_on_basis([5,5,5], [10,3])\n 3*a3*a5*a5\n sage: L.bracket_on_basis([10,10,10], [5,3])\n -3*a3*b5*b5\n '
g = self._g
ret = {}
one = self.base_ring().one()
for (i, xi) in enumerate(x):
for (j, yj) in enumerate(y):
if (((xi <= g) and (yj <= g)) or ((xi > g) and (yj > g))):
continue
if ((xi <= g) and (yj > g)):
if (xi != (yj - g)):
continue
m = _Partitions(sorted((((x[:i] + x[(i + 1):]) + y[:j]) + y[(j + 1):]), reverse=True))
if (m in ret):
ret[m] += one
else:
ret[m] = one
else:
if ((xi - g) != yj):
continue
m = _Partitions(sorted((((x[:i] + x[(i + 1):]) + y[:j]) + y[(j + 1):]), reverse=True))
if (m in ret):
ret[m] -= one
else:
ret[m] = (- one)
return self._from_dict(ret, remove_zeros=True)
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L.an_element()\n a1*a2 - 1/2*a1*a2*a2*a5 + a1*a1*a2*b1*b4\n '
d = self.monomial
return ((d(_Partitions([2, 1])) - (self.base_ring().an_element() * d(_Partitions([5, 2, 2, 1])))) + d(_Partitions([((2 * self._g) - 1), (self._g + 1), 2, 1, 1])))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.SymplecticDerivation(QQ, 5)\n sage: L.some_elements()\n [a1*a2, b1*b3, a1*a1*a2, b3*b4, a1*a4*b3,\n a1*a2 - 1/2*a1*a2*a2*a5 + a1*a1*a2*b1*b4]\n '
d = self.monomial
g = self._g
return [d(_Partitions([2, 1])), d(_Partitions([(g + 3), (g + 1)])), d(_Partitions([2, 1, 1])), d(_Partitions([((2 * g) - 1), ((2 * g) - 2)])), d(_Partitions([((2 * g) - 2), (g - 1), 1])), self.an_element()]
class Element(LieAlgebraElement):
pass
|
class VermaModule(CombinatorialFreeModule):
'\n A Verma module.\n\n Let `\\lambda` be a weight and `\\mathfrak{g}` be a Kac--Moody Lie\n algebra with a fixed Borel subalgebra `\\mathfrak{b} = \\mathfrak{h}\n \\oplus \\mathfrak{g}^+`. The *Verma module* `M_{\\lambda}` is a\n `U(\\mathfrak{g})`-module given by\n\n .. MATH::\n\n M_{\\lambda} := U(\\mathfrak{g}) \\otimes_{U(\\mathfrak{b})} F_{\\lambda},\n\n where `F_{\\lambda}` is the `U(\\mathfrak{b})` module such that\n `h \\in U(\\mathfrak{h})` acts as multiplication by\n `\\langle \\lambda, h \\rangle` and `U\\mathfrak{g}^+) F_{\\lambda} = 0`.\n\n INPUT:\n\n - ``g`` -- a Lie algebra\n - ``weight`` -- a weight\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(2*La[1] + 3*La[2])\n sage: pbw = M.pbw_basis()\n sage: E1,E2,F1,F2,H1,H2 = [pbw(g) for g in L.gens()]\n sage: v = M.highest_weight_vector()\n sage: x = F2^3 * F1 * v\n sage: x\n f[-alpha[2]]^3*f[-alpha[1]]*v[2*Lambda[1] + 3*Lambda[2]]\n sage: F1 * x\n f[-alpha[2]]^3*f[-alpha[1]]^2*v[2*Lambda[1] + 3*Lambda[2]]\n + 3*f[-alpha[2]]^2*f[-alpha[1]]*f[-alpha[1] - alpha[2]]*v[2*Lambda[1] + 3*Lambda[2]]\n sage: E1 * x\n 2*f[-alpha[2]]^3*v[2*Lambda[1] + 3*Lambda[2]]\n sage: H1 * x\n 3*f[-alpha[2]]^3*f[-alpha[1]]*v[2*Lambda[1] + 3*Lambda[2]]\n sage: H2 * x\n -2*f[-alpha[2]]^3*f[-alpha[1]]*v[2*Lambda[1] + 3*Lambda[2]]\n\n REFERENCES:\n\n - :wikipedia:`Verma_module`\n '
def __init__(self, g, weight, basis_key=None, prefix='f', **kwds):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + 4*La[2])\n sage: TestSuite(M).run()\n sage: M = L.verma_module(La[1] - 2*La[2])\n sage: TestSuite(M).run()\n\n sage: L = lie_algebras.sp(QQ, 4)\n sage: La = L.cartan_type().root_system().ambient_space().fundamental_weights()\n sage: M = L.verma_module(-1/2*La[1] + 3/7*La[2])\n sage: TestSuite(M).run()\n '
if (basis_key is not None):
self._basis_key = basis_key
else:
self._basis_key = g._basis_key
self._weight = weight
R = g.base_ring()
self._g = g
self._pbw = g.pbw_basis(basis_key=self._triangular_key)
monomials = IndexedFreeAbelianMonoid(g._negative_half_index_set(), prefix, sorting_key=self._monoid_key, **kwds)
CombinatorialFreeModule.__init__(self, R, monomials, prefix='', bracket=False, latex_bracket=False, sorting_key=self._monomial_key, category=Modules(R).WithBasis().Graded())
def _triangular_key(self, x):
'\n Return a key for sorting for the index ``x`` that respects\n the triangular decomposition by `U^-, U^0, U^+`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1])\n sage: sorted(L.basis().keys(), key=L._basis_key)\n [alpha[2], alpha[1], alpha[1] + alpha[2],\n alphacheck[1], alphacheck[2],\n -alpha[2], -alpha[1], -alpha[1] - alpha[2]]\n sage: sorted(L.basis().keys(), key=M._triangular_key)\n [-alpha[2], -alpha[1], -alpha[1] - alpha[2],\n alphacheck[1], alphacheck[2],\n alpha[2], alpha[1], alpha[1] + alpha[2]]\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: sorted(L.basis().keys(), key=neg_key)\n [-alpha[1] - alpha[2], -alpha[1], -alpha[2],\n alphacheck[2], alphacheck[1],\n alpha[1] + alpha[2], alpha[1], alpha[2]]\n sage: N = L.verma_module(La[1], basis_key=neg_key)\n sage: sorted(L.basis().keys(), key=N._triangular_key)\n [-alpha[1] - alpha[2], -alpha[1], -alpha[2],\n alphacheck[2], alphacheck[1],\n alpha[1] + alpha[2], alpha[1], alpha[2]]\n '
return (self._g._part_on_basis(x), self._basis_key(x))
def _monoid_key(self, x):
'\n Return a key for comparison in the underlying monoid of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1])\n sage: monoid = M.basis().keys()\n sage: prod(monoid.gens()) # indirect doctest\n f[-alpha[2]]*f[-alpha[1]]*f[-alpha[1] - alpha[2]]\n sage: [M._monoid_key(x) for x in monoid.an_element()._sorted_items()]\n [5, 6, 7]\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: M = L.verma_module(La[1], basis_key=neg_key)\n sage: monoid = M.basis().keys()\n sage: prod(monoid.gens()) # indirect doctest\n f[-alpha[1] - alpha[2]]*f[-alpha[1]]*f[-alpha[2]]\n sage: [M._monoid_key(x) for x in monoid.an_element()._sorted_items()]\n [-7, -6, -5]\n '
return self._basis_key(x[0])
def _monomial_key(self, x):
'\n Compute the key for ``x`` so that the comparison is done by\n triangular decomposition and then reverse degree lexicographic order.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1])\n sage: pbw = M.pbw_basis()\n sage: f1,f2 = pbw(L.f(1)), pbw(L.f(2))\n sage: f1 * f2 * f1 * M.highest_weight_vector() # indirect doctest\n f[-alpha[2]]*f[-alpha[1]]^2*v[Lambda[1]]\n + f[-alpha[1]]*f[-alpha[1] - alpha[2]]*v[Lambda[1]]\n\n sage: def neg_key(x):\n ....: return -L.basis().keys().index(x)\n sage: M = L.verma_module(La[1], basis_key=neg_key)\n sage: f1 * f2 * f1 * M.highest_weight_vector() # indirect doctest\n f[-alpha[1]]^2*f[-alpha[2]]*v[Lambda[1]]\n - f[-alpha[1] - alpha[2]]*f[-alpha[1]]*v[Lambda[1]]\n '
return ((- len(x)), [self._triangular_key(l) for l in x.to_word_list()])
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, cartan_type=['E',6])\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(2*La[1] + 3*La[2] - 5*La[5])\n sage: M\n Verma module with highest weight 2*Lambda[1] + 3*Lambda[2] - 5*Lambda[5]\n of Lie algebra of ['E', 6] in the Chevalley basis\n "
return 'Verma module with highest weight {} of {}'.format(self._weight, self._g)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: L = LieAlgebra(QQ, cartan_type=['E',7])\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: M = L.verma_module(2*La[1] + 7*La[4] - 3/4*La[7])\n sage: latex(M)\n M_{2 \\Lambda_{1} + 7 \\Lambda_{4} - \\frac{3}{4} \\Lambda_{7}}\n "
from sage.misc.latex import latex
return 'M_{{{}}}'.format(latex(self._weight))
def _repr_generator(self, m):
"\n Return a string representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 4)\n sage: La = L.cartan_type().root_system().ambient_space().fundamental_weights()\n sage: M = L.verma_module(-1/2*La[1] + 3/7*La[2])\n sage: f1, f2 = L.f(1), L.f(2)\n sage: x = M.pbw_basis()(L([f1, [f1, f2]]))\n sage: v = x * M.highest_weight_vector()\n sage: M._repr_generator(v.leading_support())\n 'f[-2*alpha[1] - alpha[2]]*v[(-1/14, 3/7)]'\n\n sage: M.highest_weight_vector()\n v[(-1/14, 3/7)]\n sage: 2 * M.highest_weight_vector()\n 2*v[(-1/14, 3/7)]\n "
ret = super()._repr_generator(m)
if (ret == '1'):
ret = ''
else:
ret += '*'
return (ret + 'v[{}]'.format(self._weight))
def _latex_generator(self, m):
'\n Return a latex representation of the generator indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 4)\n sage: La = L.cartan_type().root_system().ambient_space().fundamental_weights()\n sage: M = L.verma_module(-1/2*La[1] + 3/7*La[2])\n sage: f1, f2 = L.f(1), L.f(2)\n sage: x = M.pbw_basis()(L([f1, [f1, f2]]))\n sage: v = x * M.highest_weight_vector()\n sage: M._latex_generator(v.leading_support())\n f_{-2 \\alpha_{1} - \\alpha_{2}} v_{-\\frac{1}{14} e_{0} + \\frac{3}{7} e_{1}}\n\n sage: latex(2 * M.highest_weight_vector())\n 2 v_{-\\frac{1}{14} e_{0} + \\frac{3}{7} e_{1}}\n sage: latex(M.highest_weight_vector())\n v_{-\\frac{1}{14} e_{0} + \\frac{3}{7} e_{1}}\n '
ret = super()._latex_generator(m)
if (ret == '1'):
ret = ''
from sage.misc.latex import latex
return (ret + ' v_{{{}}}'.format(latex(self._weight)))
_repr_term = _repr_generator
_latex_term = _latex_generator
def lie_algebra(self):
"\n Return the underlying Lie algebra of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.so(QQ, 9)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: M = L.verma_module(La[3] - 1/2*La[1])\n sage: M.lie_algebra()\n Lie algebra of ['B', 4] in the Chevalley basis\n "
return self._g
def pbw_basis(self):
"\n Return the PBW basis of the underlying Lie algebra\n used to define ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.so(QQ, 8)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[2] - 2*La[3])\n sage: M.pbw_basis()\n Universal enveloping algebra of Lie algebra of ['D', 4] in the Chevalley basis\n in the Poincare-Birkhoff-Witt basis\n "
return self._pbw
poincare_birkhoff_witt_basis = pbw_basis
@cached_method
def highest_weight_vector(self):
'\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] - 3*La[2])\n sage: M.highest_weight_vector()\n v[Lambda[1] - 3*Lambda[2]]\n '
one = self.base_ring().one()
return self._from_dict({self._indices.one(): one}, remove_zeros=False, coerce=False)
def gens(self):
'\n Return the generators of ``self`` as a `U(\\mathfrak{g})`-module.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] - 3*La[2])\n sage: M.gens()\n (v[Lambda[1] - 3*Lambda[2]],)\n '
return (self.highest_weight_vector(),)
def highest_weight(self):
'\n Return the highest weight of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.so(QQ, 7)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: M = L.verma_module(4*La[1] - 3/2*La[2])\n sage: M.highest_weight()\n 4*Lambda[1] - 3/2*Lambda[2]\n '
return self._weight
def degree_on_basis(self, m):
'\n Return the degree (or weight) of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(2*La[1] + 3*La[2])\n sage: v = M.highest_weight_vector()\n sage: M.degree_on_basis(v.leading_support())\n 2*Lambda[1] + 3*Lambda[2]\n\n sage: pbw = M.pbw_basis()\n sage: G = list(pbw.gens())\n sage: f1, f2 = L.f()\n sage: x = pbw(f1.bracket(f2)) * pbw(f1) * v\n sage: x.degree()\n -Lambda[1] + 3*Lambda[2]\n '
P = self._weight.parent()
return (self._weight + P.sum((P((e * self._g.degree_on_basis(k))) for (k, e) in m.dict().items())))
def _coerce_map_from_(self, R):
'\n Return if there is a coercion map from ``R`` to ``self``.\n\n There is a coercion map from ``R`` if and only if\n\n - there is a coercion from ``R`` into the base ring;\n - ``R`` is a Verma module over the same Lie algebra and\n there is a non-zero Verma module morphism from ``R``\n into ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.so(QQ, 8)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: Mpp = L.verma_module(M.highest_weight().dot_action([1,2]) + La[1])\n sage: M._coerce_map_from_(Mp) is not None\n True\n sage: Mp._coerce_map_from_(M)\n sage: M._coerce_map_from_(Mpp)\n sage: M._coerce_map_from_(ZZ)\n True\n '
if self.base_ring().has_coerce_map_from(R):
return True
if (isinstance(R, VermaModule) and (R._g is self._g)):
H = Hom(R, self)
if (H.dimension() == 1):
return H.natural_map()
return super()._coerce_map_from_(R)
def _element_constructor_(self, x):
'\n Construct an element of ``self`` from ``x``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + 2*La[2])\n sage: M(3)\n 3*v[Lambda[1] + 2*Lambda[2]]\n sage: pbw = M.pbw_basis()\n sage: [M(g) for g in pbw.gens()]\n [0,\n 0,\n 0,\n v[Lambda[1] + 2*Lambda[2]],\n 2*v[Lambda[1] + 2*Lambda[2]],\n f[-alpha[2]]*v[Lambda[1] + 2*Lambda[2]],\n f[-alpha[1]]*v[Lambda[1] + 2*Lambda[2]],\n f[-alpha[1] - alpha[2]]*v[Lambda[1] + 2*Lambda[2]]]\n '
if (x in self.base_ring()):
return self._from_dict({self._indices.one(): x})
if isinstance(x, self._pbw.element_class):
return self.highest_weight_vector()._acted_upon_(x, False)
return super()._element_constructor_(self, x)
@lazy_attribute
def _dominant_data(self):
'\n Return the closest to dominant weight in the dot orbit of\n the highest weight of ``self`` and the corresponding reduced word.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: M._dominant_data\n (Lambda[1] + Lambda[2], [])\n sage: M = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: M._dominant_data\n (Lambda[1] + Lambda[2], [1, 2])\n sage: M = L.verma_module(-4*La[1] - La[2])\n sage: M._dominant_data\n (-Lambda[1] + 2*Lambda[2], [1, 2])\n '
P = self._weight.parent()
(wt, w) = (self._weight + P.rho()).to_dominant_chamber(reduced_word=True)
return ((wt - P.rho()), w)
def is_singular(self):
'\n Return if ``self`` is a singular Verma module.\n\n A Verma module `M_{\\lambda}` is *singular* if there does not\n exist a dominant weight `\\tilde{\\lambda}` that is in the dot\n orbit of `\\lambda`. We call a Verma module *regular* otherwise.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: M.is_singular()\n False\n sage: M = L.verma_module(La[1] - La[2])\n sage: M.is_singular()\n True\n sage: M = L.verma_module(2*La[1] - 10*La[2])\n sage: M.is_singular()\n False\n sage: M = L.verma_module(-2*La[1] - 2*La[2])\n sage: M.is_singular()\n False\n sage: M = L.verma_module(-4*La[1] - La[2])\n sage: M.is_singular()\n True\n '
return (not self._dominant_data[0].is_dominant())
def homogeneous_component_basis(self, d):
'\n Return a basis for the ``d``-th homogeneous component of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: P = L.cartan_type().root_system().weight_lattice()\n sage: La = P.fundamental_weights()\n sage: al = P.simple_roots()\n sage: mu = 2*La[1] + 3*La[2]\n sage: M = L.verma_module(mu)\n sage: M.homogeneous_component_basis(mu - al[2])\n [f[-alpha[2]]*v[2*Lambda[1] + 3*Lambda[2]]]\n sage: M.homogeneous_component_basis(mu - 3*al[2])\n [f[-alpha[2]]^3*v[2*Lambda[1] + 3*Lambda[2]]]\n sage: M.homogeneous_component_basis(mu - 3*al[2] - 2*al[1])\n [f[-alpha[2]]*f[-alpha[1] - alpha[2]]^2*v[2*Lambda[1] + 3*Lambda[2]],\n f[-alpha[2]]^2*f[-alpha[1]]*f[-alpha[1] - alpha[2]]*v[2*Lambda[1] + 3*Lambda[2]],\n f[-alpha[2]]^3*f[-alpha[1]]^2*v[2*Lambda[1] + 3*Lambda[2]]]\n sage: M.homogeneous_component_basis(mu - La[1])\n Family ()\n '
diff = _convert_wt_to_root((d - self._weight))
if ((diff is None) or (not all((((coeff <= 0) and (coeff in ZZ)) for coeff in diff)))):
return Family([])
return sorted(self._homogeneous_component_f(diff))
@cached_method
def _homogeneous_component_f(self, d):
'\n Return a basis of the PBW given by ``d`` expressed in the\n root lattice in terms of the simple roots.\n\n INPUT:\n\n - ``d`` -- the coefficients of the simple roots as a vector\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: sorted(M._homogeneous_component_f(vector([-1,-2])), key=str)\n [f[-alpha[2]]*f[-alpha[1] - alpha[2]]*v[Lambda[1] + Lambda[2]],\n f[-alpha[2]]^2*f[-alpha[1]]*v[Lambda[1] + Lambda[2]]]\n sage: sorted(M._homogeneous_component_f(vector([-5,-4])), key=str)\n [f[-alpha[1]]*f[-alpha[1] - alpha[2]]^4*v[Lambda[1] + Lambda[2]],\n f[-alpha[2]]*f[-alpha[1]]^2*f[-alpha[1] - alpha[2]]^3*v[Lambda[1] + Lambda[2]],\n f[-alpha[2]]^2*f[-alpha[1]]^3*f[-alpha[1] - alpha[2]]^2*v[Lambda[1] + Lambda[2]],\n f[-alpha[2]]^3*f[-alpha[1]]^4*f[-alpha[1] - alpha[2]]*v[Lambda[1] + Lambda[2]],\n f[-alpha[2]]^4*f[-alpha[1]]^5*v[Lambda[1] + Lambda[2]]]\n '
if (not d):
return frozenset([self.highest_weight_vector()])
f = {i: self._pbw(g) for (i, g) in enumerate(self._g.f())}
basis = d.parent().basis()
ret = set()
def degree(m):
m = m.dict()
if (not m):
return d.parent().zero()
return sum(((e * self._g.degree_on_basis(k)) for (k, e) in m.items())).to_vector()
for i in f:
if (d[i] == 0):
continue
for b in self._homogeneous_component_f((d + basis[i])):
temp = (f[i] * b)
ret.update([self.monomial(m) for m in temp.support() if (degree(m) == d)])
return frozenset(ret)
def _Hom_(self, Y, category=None, **options):
"\n Return the homset from ``self`` to ``Y`` in the\n category ``category``.\n\n INPUT:\n\n - ``Y`` -- an object\n - ``category`` -- a subcategory of :class:`Crystals`() or ``None``\n\n The sole purpose of this method is to construct the homset as a\n :class:`~sage.algebras.lie_algebras.verma_module.VermaModuleHomset`.\n If ``category`` is specified and is not a subcategory of\n ``self.category()``, a :class:`TypeError` is raised instead.\n\n This method is not meant to be called directly. Please use\n :func:`sage.categories.homset.Hom` instead.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(3*La[1] - 3*La[2])\n sage: H = Hom(M, Mp)\n sage: type(H)\n <...VermaModuleHomset_with_category_with_equality_by_id'>\n "
if (not (isinstance(Y, VermaModule) and (self._g is Y._g))):
raise TypeError('{} must be a Verma module of {}'.format(Y, self._g))
if ((category is not None) and (not category.is_subcategory(self.category()))):
raise TypeError('{} is not a subcategory of {}'.format(category, self.category()))
return VermaModuleHomset(self, Y)
class Element(CombinatorialFreeModule.Element):
def _acted_upon_(self, scalar, self_on_left=False):
'\n Return the action of ``scalar`` on ``self``.\n\n Check that other PBW algebras have an action::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] - 3*La[2])\n sage: PBW = L.pbw_basis()\n sage: F1 = PBW(L.f(1))\n sage: F1 * M.highest_weight_vector()\n f[-alpha[1]]*v[Lambda[1] - 3*Lambda[2]]\n sage: F1.parent() is M.pbw_basis()\n False\n sage: F1 * M.highest_weight_vector()\n f[-alpha[1]]*v[Lambda[1] - 3*Lambda[2]]\n sage: E1 = PBW(L.e(1))\n sage: E1 * F1\n PBW[alpha[1]]*PBW[-alpha[1]]\n sage: E1 * F1 * M.highest_weight_vector()\n v[Lambda[1] - 3*Lambda[2]]\n sage: M.pbw_basis()(E1 * F1)\n PBW[-alpha[1]]*PBW[alpha[1]] + PBW[alphacheck[1]]\n '
P = self.parent()
if (scalar in P.base_ring()):
return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
try:
scalar = P._g(scalar)
except (ValueError, TypeError):
pass
try:
scalar = P._pbw(scalar)
except (ValueError, TypeError):
return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
if self_on_left:
return None
mc = self._monomial_coefficients
d = {P._pbw._indices(x.dict()): mc[x] for x in mc}
ret = (scalar * P._pbw._from_dict(d, remove_zeros=False, coerce=False))
d = {}
for m in ret._monomial_coefficients:
c = ret._monomial_coefficients[m]
mp = {}
for (k, e) in reversed(m._sorted_items()):
part = P._g._part_on_basis(k)
if (part > 0):
mp = None
break
elif (part == 0):
c *= (P._g._weight_action(k, P._weight) ** e)
else:
mp[k] = e
if (mp is None):
continue
mp = P._indices(mp)
if (mp in d):
d[mp] += c
else:
d[mp] = c
return P._from_dict(d)
_lmul_ = _acted_upon_
_rmul_ = _acted_upon_
|
class VermaModuleMorphism(Morphism):
'\n A morphism of Verma modules.\n '
def __init__(self, parent, scalar):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: TestSuite(phi).run()\n '
self._scalar = scalar
Morphism.__init__(self, parent)
def _repr_type(self):
"\n Return a string describing the specific type of this map,\n to be used when printing ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi._repr_type()\n 'Verma module'\n "
return 'Verma module'
def _repr_defn(self):
"\n Return a string describing the definition of ``self``,\n to be used when printing ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi._repr_defn()\n 'v[-5*Lambda[1] + Lambda[2]] |--> f[-alpha[2]]^2*f[-alpha[1]]^4*v[Lambda[1]\n + Lambda[2]] + 8*f[-alpha[2]]*f[-alpha[1]]^3*f[-alpha[1] - alpha[2]]*v[Lambda[1]\n + Lambda[2]] + 12*f[-alpha[1]]^2*f[-alpha[1] - alpha[2]]^2*v[Lambda[1] + Lambda[2]]'\n\n alpha[1]]^2*f[-alpha[1] - alpha[2]]^2*v[Lambda[1] + Lambda[2]]'\n sage: psi = Hom(M, Mp).natural_map()\n sage: psi\n Verma module morphism:\n From: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n To: Verma module with highest weight -5*Lambda[1] + Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n Defn: v[Lambda[1] + Lambda[2]] |--> 0\n "
v = self.domain().highest_weight_vector()
if (not self._scalar):
return '{} |--> {}'.format(v, self.codomain().zero())
return '{} |--> {}'.format(v, (self._scalar * self.parent().singular_vector()))
def _richcmp_(self, other, op):
'\n Return whether this morphism and ``other`` satisfy ``op``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: H = Hom(Mp, M)\n sage: H(1) < H(2)\n True\n sage: H(2) < H(1)\n False\n sage: H.zero() == H(0)\n True\n sage: H(3) <= H(3)\n True\n '
return richcmp(self._scalar, other._scalar, op)
def _call_(self, x):
'\n Apply this morphism to ``x``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: pbw = M.pbw_basis()\n sage: f1, f2 = pbw(L.f(1)), pbw(L.f(2))\n sage: v = Mp.highest_weight_vector()\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi(f1 * v) == f1 * phi(v)\n True\n sage: phi(f2 * f1 * v) == f2 * f1 * phi(v)\n True\n sage: phi(f1 * f2 * f1 * v) == f1 * f2 * f1 * phi(v)\n True\n\n sage: Mpp = L.verma_module(M.highest_weight().dot_action([1,2]) + La[1])\n sage: psi = Hom(Mpp, M).natural_map()\n sage: v = Mpp.highest_weight_vector()\n sage: psi(v)\n 0\n '
if ((not self._scalar) or (self.parent().singular_vector() is None)):
return self.codomain().zero()
mc = x.monomial_coefficients(copy=False)
return self.codomain().linear_combination(((self._on_basis(m), (self._scalar * c)) for (m, c) in mc.items()))
def _on_basis(self, m):
'\n Return the image of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: pbw = M.pbw_basis()\n sage: f1, f2 = pbw(L.f(1)), pbw(L.f(2))\n sage: v = Mp.highest_weight_vector()\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi._on_basis((f1 * v).leading_support()) == f1 * phi(v)\n True\n '
pbw = self.codomain()._pbw
return (pbw.monomial(pbw._indices(m.dict())) * self.parent().singular_vector())
def _add_(self, other):
'\n Add ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: (phi + 3/2 * phi)._scalar\n 5/2\n '
return type(self)(self.parent(), (self._scalar + other._scalar))
def _sub_(self, other):
'\n Subtract ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: (phi - 3/2 * phi)._scalar\n -1/2\n '
return type(self)(self.parent(), (self._scalar - other._scalar))
def _acted_upon_(self, other, self_on_left):
'\n Return the action of ``other`` on ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi._scalar\n 1\n sage: (0 * phi)._scalar\n 0\n sage: R.<x> = QQ[]\n sage: x * phi\n Traceback (most recent call last):\n ...\n TypeError: unsupported operand parent(s) for *: ...\n '
R = self.parent().base_ring()
if (other not in R):
return None
return type(self)(self.parent(), (R(other) * self._scalar))
def _composition_(self, right, homset):
'\n Return the composition of ``self`` and ``right``.\n\n INPUT:\n\n - ``self``, ``right`` -- maps\n - homset -- a homset\n\n ASSUMPTION:\n\n The codomain of ``right`` is contained in the domain of ``self``.\n This assumption is not verified.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: Mpp = L.verma_module(M.highest_weight().dot_action([1,2]) + La[1])\n sage: phi = Hom(Mp, M).natural_map()\n sage: psi = Hom(Mpp, Mp).natural_map()\n sage: xi = phi * psi\n sage: xi._scalar\n 0\n '
if (isinstance(right, VermaModuleMorphism) and (right.domain()._g is self.codomain()._g)):
return homset.element_class(homset, (right._scalar * self._scalar))
return super()._composition_(right, homset)
def is_injective(self):
"\n Return if ``self`` is injective or not.\n\n A Verma module morphism `\\phi : M \\to M'` is injective if\n and only if `\\dim \\hom(M, M') = 1` and `\\phi \\neq 0`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: Mpp = L.verma_module(M.highest_weight().dot_action([1,2]) + La[1])\n sage: phi = Hom(Mp, M).natural_map()\n sage: phi.is_injective()\n True\n sage: (0 * phi).is_injective()\n False\n sage: psi = Hom(Mpp, Mp).natural_map()\n sage: psi.is_injective()\n False\n "
return ((self.parent().singular_vector() is not None) and bool(self._scalar))
def is_surjective(self):
'\n Return if ``self`` is surjective or not.\n\n A Verma module morphism is surjective if and only if the\n domain is equal to the codomain and it is not the zero\n morphism.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: phi = Hom(M, M).natural_map()\n sage: phi.is_surjective()\n True\n sage: (0 * phi).is_surjective()\n False\n sage: psi = Hom(Mp, M).natural_map()\n sage: psi.is_surjective()\n False\n '
return ((self.domain() == self.codomain()) and bool(self._scalar))
|
class VermaModuleHomset(Homset):
"\n The set of morphisms from one Verma module to another\n considered as `U(\\mathfrak{g})`-representations.\n\n Let `M_{w \\cdot \\lambda}` and `M_{w' \\cdot \\lambda'}` be\n Verma modules, `\\cdot` is the dot action, and `\\lambda + \\rho`,\n `\\lambda' + \\rho` are dominant weights. Then we have\n\n .. MATH::\n\n \\dim \\hom(M_{w \\cdot \\lambda}, M_{w' \\cdot \\lambda'}) = 1\n\n if and only if `\\lambda = \\lambda'` and `w' \\leq w` in Bruhat\n order. Otherwise the homset is 0 dimensional.\n "
def __call__(self, x, **options):
"\n Construct a morphism in this homset from ``x`` if possible.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([1,2]))\n sage: Mpp = L.verma_module(M.highest_weight().dot_action([1,2,1]))\n sage: phi = Hom(Mp, M).natural_map()\n sage: Hom(Mpp, M)(phi)\n Verma module morphism:\n From: Verma module with highest weight -3*Lambda[1] - 3*Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n Defn: v[-3*Lambda[1] - 3*Lambda[2]] |-->\n f[-alpha[2]]^4*f[-alpha[1]]^4*v[Lambda[1] + Lambda[2]]\n + 8*f[-alpha[2]]^3*f[-alpha[1]]^3*f[-alpha[1] - alpha[2]]*v[Lambda[1] + Lambda[2]]\n + 12*f[-alpha[2]]^2*f[-alpha[1]]^2*f[-alpha[1] - alpha[2]]^2*v[Lambda[1] + Lambda[2]]\n\n sage: psi = Hom(Mpp, Mp).natural_map()\n sage: Hom(Mpp, M)(psi)\n Verma module morphism:\n From: Verma module with highest weight -3*Lambda[1] - 3*Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n Defn: v[-3*Lambda[1] - 3*Lambda[2]] |-->\n f[-alpha[2]]^4*f[-alpha[1]]^4*v[Lambda[1] + Lambda[2]]\n + 8*f[-alpha[2]]^3*f[-alpha[1]]^3*f[-alpha[1] - alpha[2]]*v[Lambda[1] + Lambda[2]]\n + 12*f[-alpha[2]]^2*f[-alpha[1]]^2*f[-alpha[1] - alpha[2]]^2*v[Lambda[1] + Lambda[2]]\n "
if isinstance(x, VermaModuleMorphism):
if (x.parent() is self):
return x
if (x.parent() == self):
x._set_parent(self)
return x
if (x.domain() != self.domain()):
x = (x * Hom(self.domain(), x.domain()).natural_map())
if (x.codomain() != self.codomain()):
x = (Hom(x.codomain(), self.codomain()).natural_map() * x)
return x
if (x in self.base_ring()):
if (self.singular_vector() is None):
return self.zero()
return self.element_class(self, self.base_ring()(x))
return super().__call__(x, **options)
def _an_element_(self):
"\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([2]))\n sage: H = Hom(Mp, M)\n sage: H._an_element_()\n Verma module morphism:\n From: Verma module with highest weight 3*Lambda[1] - 3*Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of ['A', 2] in the Chevalley basis\n Defn: v[3*Lambda[1] - 3*Lambda[2]] |-->\n f[-alpha[2]]^2*v[Lambda[1] + Lambda[2]]\n "
return self.natural_map()
@cached_method
def singular_vector(self):
"\n Return the singular vector in the codomain corresponding\n to the domain's highest weight element or ``None`` if no\n such element exists.\n\n ALGORITHM:\n\n We essentially follow the algorithm laid out in [deG2005]_.\n We use the `\\mathfrak{sl}_2` relation on\n `M_{s_i \\cdot \\lambda} \\to M_{\\lambda}`, where\n `\\langle \\lambda + \\delta, \\alpha_i^{\\vee} \\rangle = m > 0`,\n i.e., the weight `\\lambda` is `i`-dominant with respect to\n the dot action. From here, we construct the singular vector\n `f_i^m v_{\\lambda}`. We iterate this until we reach `\\mu`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: la = La[1] - La[3]\n sage: mu = la.dot_action([1,2])\n sage: M = L.verma_module(la)\n sage: Mp = L.verma_module(mu)\n sage: H = Hom(Mp, M)\n sage: H.singular_vector()\n f[-alpha[2]]*f[-alpha[1]]^3*v[Lambda[1] - Lambda[3]]\n + 3*f[-alpha[1]]^2*f[-alpha[1] - alpha[2]]*v[Lambda[1] - Lambda[3]]\n\n ::\n\n sage: L = LieAlgebra(QQ, cartan_type=['F',4])\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: la = La[1] + La[2] - La[3]\n sage: mu = la.dot_action([1,2,3,2])\n sage: M = L.verma_module(la)\n sage: Mp = L.verma_module(mu)\n sage: H = Hom(Mp, M)\n sage: v = H.singular_vector()\n sage: pbw = M.pbw_basis()\n sage: E = [pbw(e) for e in L.e()]\n sage: all(e * v == M.zero() for e in E)\n True\n\n When `w \\cdot \\lambda \\notin \\lambda + Q^-`, there does not\n exist a singular vector::\n\n sage: L = lie_algebras.sl(QQ, 4)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: la = 3/7*La[1] - 1/2*La[3]\n sage: mu = la.dot_action([1,2])\n sage: M = L.verma_module(la)\n sage: Mp = L.verma_module(mu)\n sage: H = Hom(Mp, M)\n sage: H.singular_vector() is None\n True\n\n TESTS::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: al = L.cartan_type().root_system().root_lattice().simple_roots()\n sage: M = L.verma_module(La[1] + La[2])\n sage: pbw = M.pbw_basis()\n sage: E = {i: pbw(L.e(i)) for i in L.cartan_type().index_set()}\n sage: all(not E[i] * Hom(L.verma_module(mu), M).singular_vector()\n ....: for i in L.cartan_type().index_set()\n ....: for mu in M.highest_weight().dot_orbit())\n True\n "
if self.is_endomorphism_set():
return self.codomain().highest_weight_vector()
if (self.domain()._dominant_data[0] != self.codomain()._dominant_data[0]):
return None
from sage.combinat.root_system.coxeter_group import CoxeterGroup
W = CoxeterGroup(self.domain()._g._cartan_type)
wp = W.from_reduced_word(self.domain()._dominant_data[1])
w = W.from_reduced_word(self.codomain()._dominant_data[1])
if (not w.bruhat_le(wp)):
return None
C = self.codomain()
pbw = C._pbw
f = C._g.f()
F = {i: pbw(f[i]) for i in f.keys()}
red_word = (wp * (~ w)).reduced_word()
rho = C._weight.parent().rho()
ac = C._weight.parent().simple_coroots()
elt = pbw.one()
wt = C._weight
for i in reversed(red_word):
exp = (wt + rho).scalar(ac[i])
if ((exp not in ZZ) or (exp < 0)):
return None
elt = ((F[i] ** ZZ(exp)) * elt)
wt = wt.dot_action([i])
return C.highest_weight_vector()._acted_upon_(elt, False)
@cached_method
def natural_map(self):
'\n Return the "natural map" of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([2]))\n sage: H = Hom(Mp, M)\n sage: H.natural_map()\n Verma module morphism:\n From: Verma module with highest weight 3*Lambda[1] - 3*Lambda[2]\n of Lie algebra of [\'A\', 2] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of [\'A\', 2] in the Chevalley basis\n Defn: v[3*Lambda[1] - 3*Lambda[2]] |-->\n f[-alpha[2]]^2*v[Lambda[1] + Lambda[2]]\n\n sage: Mp = L.verma_module(La[1] + 2*La[2])\n sage: H = Hom(Mp, M)\n sage: H.natural_map()\n Verma module morphism:\n From: Verma module with highest weight Lambda[1] + 2*Lambda[2]\n of Lie algebra of [\'A\', 2] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + Lambda[2]\n of Lie algebra of [\'A\', 2] in the Chevalley basis\n Defn: v[Lambda[1] + 2*Lambda[2]] |--> 0\n '
if (self.singular_vector() is None):
return self.zero()
return self.element_class(self, self.base_ring().one())
@cached_method
def zero(self):
"\n Return the zero morphism of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sp(QQ, 6)\n sage: La = L.cartan_type().root_system().weight_space().fundamental_weights()\n sage: M = L.verma_module(La[1] + 2/3*La[2])\n sage: Mp = L.verma_module(La[2] - La[3])\n sage: H = Hom(Mp, M)\n sage: H.zero()\n Verma module morphism:\n From: Verma module with highest weight Lambda[2] - Lambda[3]\n of Lie algebra of ['C', 3] in the Chevalley basis\n To: Verma module with highest weight Lambda[1] + 2/3*Lambda[2]\n of Lie algebra of ['C', 3] in the Chevalley basis\n Defn: v[Lambda[2] - Lambda[3]] |--> 0\n "
return self.element_class(self, self.base_ring().zero())
def dimension(self):
'\n Return the dimension of ``self`` (as a vector space over\n the base ring).\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([2]))\n sage: H = Hom(Mp, M)\n sage: H.dimension()\n 1\n\n sage: Mp = L.verma_module(La[1] + 2*La[2])\n sage: H = Hom(Mp, M)\n sage: H.dimension()\n 0\n '
if (self.singular_vector() is None):
return ZZ.zero()
return ZZ.one()
def basis(self):
'\n Return a basis of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.sl(QQ, 3)\n sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: M = L.verma_module(La[1] + La[2])\n sage: Mp = L.verma_module(M.highest_weight().dot_action([2]))\n sage: H = Hom(Mp, M)\n sage: list(H.basis()) == [H.natural_map()]\n True\n\n sage: Mp = L.verma_module(La[1] + 2*La[2])\n sage: H = Hom(Mp, M)\n sage: H.basis()\n Family ()\n '
if (self.singular_vector() is None):
return Family([])
return Family([self.natural_map()])
Element = VermaModuleMorphism
|
def _convert_wt_to_root(wt):
"\n Helper function to express ``wt`` as a linear combination\n of simple roots.\n\n INPUT:\n\n - ``wt`` -- an element of a weight lattice realization\n\n OUTPUT:\n\n A vector over `\\QQ` representing ``wt`` as a linear combination\n of simple roots.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.verma_module import _convert_wt_to_root\n sage: P = RootSystem(['A',3]).weight_lattice()\n sage: La = P.fundamental_weights()\n sage: [_convert_wt_to_root(al) for al in P.simple_roots()]\n [(1, 0, 0), (0, 1, 0), (0, 0, 1)]\n sage: _convert_wt_to_root(La[1] + La[2])\n (5/4, 3/2, 3/4)\n\n sage: L = RootSystem(['A',3]).ambient_space()\n sage: e = L.basis()\n sage: _convert_wt_to_root(e[0] + 3*e[3])\n sage: _convert_wt_to_root(e[0] - e[1])\n (1, 0, 0)\n sage: _convert_wt_to_root(e[0] + 2*e[1] - 3*e[2])\n (1, 3, 0)\n "
v = wt.to_vector().change_ring(QQ)
al = [a.to_vector() for a in wt.parent().simple_roots()]
b = v.parent().linear_dependence(([v] + al))
if ((len(b) != 1) or (b[0] == 0)):
return None
b = b[0]
return vector(QQ, [((- x) / b[0]) for x in b[1:]])
|
class LieAlgebraRegularVectorFields(InfinitelyGeneratedLieAlgebra, IndexedGenerators):
"\n The Lie algebra of regular vector fields on `\\CC^{\\times}`.\n\n This is the Lie algebra with basis `\\{d_i\\}_{i \\in \\ZZ}` and subject\n to the relations\n\n .. MATH::\n\n [d_i, d_j] = (i - j) d_{i+j}.\n\n This is also known as the Witt (Lie) algebra.\n\n .. NOTE::\n\n This differs from some conventions (e.g., [Ka1990]_), where\n we have `d'_i \\mapsto -d_i`.\n\n REFERENCES:\n\n - :wikipedia:`Witt_algebra`\n\n .. SEEALSO::\n\n :class:`WittLieAlgebra_charp`\n "
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: TestSuite(L).run()\n '
cat = LieAlgebras(R).WithBasis().Graded()
InfinitelyGeneratedLieAlgebra.__init__(self, R, index_set=ZZ, category=cat)
IndexedGenerators.__init__(self, ZZ, prefix='d', bracket='[')
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.regular_vector_fields(QQ)\n The Lie algebra of regular vector fields over Rational Field\n '
return 'The Lie algebra of regular vector fields over {}'.format(self.base_ring())
_repr_term = IndexedGenerators._repr_generator
_latex_term = IndexedGenerators._latex_generator
@cached_method
def lie_algebra_generators(self):
'\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: L.lie_algebra_generators()\n Lazy family (generator map(i))_{i in Integer Ring}\n '
return Family(self._indices, self.monomial, name='generator map')
def bracket_on_basis(self, i, j):
'\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n (This particular implementation actually does not require\n ``x < y``.)\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: L.bracket_on_basis(2, -2)\n 4*d[0]\n sage: L.bracket_on_basis(2, 4)\n -2*d[6]\n sage: L.bracket_on_basis(4, 4)\n 0\n '
return self.term((i + j), (i - j))
def degree_on_basis(self, i):
'\n Return the degree of the basis element indexed by ``i``,\n which is ``i``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: L.degree_on_basis(2)\n 2\n '
return i
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: L.an_element()\n d[-1] + d[0] - 3*d[1]\n '
return ((self.monomial(0) - (3 * self.monomial(1))) + self.monomial((- 1)))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.regular_vector_fields(QQ)\n sage: L.some_elements()\n [d[0], d[2], d[-2], d[-1] + d[0] - 3*d[1]]\n '
return [self.monomial(0), self.monomial(2), self.monomial((- 2)), self.an_element()]
class Element(LieAlgebraElement):
pass
|
class WittLieAlgebra_charp(FinitelyGeneratedLieAlgebra, IndexedGenerators):
'\n The `p`-Witt Lie algebra over a ring `R` in which\n `p \\cdot 1_R = 0`.\n\n Let `R` be a ring and `p` be a positive integer such that\n `p \\cdot 1_R = 0`. The `p`-Witt Lie algebra over `R` is\n the Lie algebra with basis `\\{d_0, d_1, \\ldots, d_{p-1}\\}`\n and subject to the relations\n\n .. MATH::\n\n [d_i, d_j] = (i - j) d_{i+j},\n\n where the `i+j` on the right hand side is identified with its\n remainder modulo `p`.\n\n .. SEEALSO::\n\n :class:`LieAlgebraRegularVectorFields`\n '
def __init__(self, R, p):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(GF(5), 5); L\n The 5-Witt Lie algebra over Finite Field of size 5\n sage: TestSuite(L).run()\n\n We skip the grading test as we need to be able to echelonize a\n matrix over the base ring as part of the test::\n\n sage: L = lie_algebras.pwitt(Zmod(6), 6)\n sage: TestSuite(L).run(skip="_test_grading")\n '
if (R(p) != 0):
raise ValueError('{} is not 0 in {}'.format(p, R))
cat = LieAlgebras(R).FiniteDimensional().WithBasis().Graded()
FinitelyGeneratedLieAlgebra.__init__(self, R, index_set=list(range(p)), category=cat)
IndexedGenerators.__init__(self, list(range(p)), prefix='d', bracket='[')
self._p = p
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.pwitt(Zmod(5), 5)\n The 5-Witt Lie algebra over Ring of integers modulo 5\n sage: lie_algebras.pwitt(Zmod(5), 15)\n The 15-Witt Lie algebra over Ring of integers modulo 5\n '
return 'The {}-Witt Lie algebra over {}'.format(self._p, self.base_ring())
_repr_term = IndexedGenerators._repr_generator
_latex_term = IndexedGenerators._latex_generator
@cached_method
def lie_algebra_generators(self):
'\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(Zmod(5), 5)\n sage: L.lie_algebra_generators()\n Finite family {0: d[0], 1: d[1], 2: d[2], 3: d[3], 4: d[4]}\n '
return Family(self._indices, self.monomial, name='generator map')
def bracket_on_basis(self, i, j):
'\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n (This particular implementation actually does not require\n ``x < y``.)\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(Zmod(5), 5)\n sage: L.bracket_on_basis(2, 3)\n 4*d[0]\n sage: L.bracket_on_basis(3, 2)\n d[0]\n sage: L.bracket_on_basis(2, 2)\n 0\n sage: L.bracket_on_basis(1, 3)\n 3*d[4]\n '
return self.term(((i + j) % self._p), (i - j))
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(Zmod(5), 5)\n sage: L.an_element()\n d[0] + 2*d[1] + d[4]\n '
return ((self.monomial(0) - (3 * self.monomial((1 % self._p)))) + self.monomial(((- 1) % self._p)))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(Zmod(5), 5)\n sage: L.some_elements()\n [d[0], d[2], d[3], d[0] + 2*d[1] + d[4]]\n '
return [self.monomial(0), self.monomial((2 % self._p)), self.monomial(((- 2) % self._p)), self.an_element()]
def degree_on_basis(self, i):
'\n Return the degree of the basis element indexed by ``i``,\n which is ``i`` mod `p`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.pwitt(Zmod(5), 5)\n sage: L.degree_on_basis(7)\n 2\n sage: L.degree_on_basis(2).parent()\n Ring of integers modulo 5\n '
return IntegerModRing(self._p)(i)
class Element(LieAlgebraElement):
pass
|
def _basis_key(x):
"\n Helper function that generates a key for the basis elements\n of the Virasoro algebra.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.virasoro import _basis_key\n sage: _basis_key('c')\n +Infinity\n sage: _basis_key(2)\n 2\n "
if (x == 'c'):
from sage.rings.infinity import infinity
return infinity
return x
|
class VirasoroAlgebra(InfinitelyGeneratedLieAlgebra, IndexedGenerators):
'\n The Virasoro algebra.\n\n This is the Lie algebra with basis `\\{d_i\\}_{i \\in \\ZZ} \\cup \\{c\\}`\n and subject to the relations\n\n .. MATH::\n\n [d_i, d_j] = (i - j) d_{i+j} + \\frac{1}{12}(i^3 - i) \\delta_{i,-j} c\n\n and\n\n .. MATH::\n\n [d_i, c] = 0.\n\n (Here, it is assumed that the base ring `R` has `2` invertible.)\n\n This is the universal central extension `\\widetilde{\\mathfrak{d}}` of\n the Lie algebra `\\mathfrak{d}` of\n :class:`regular vector fields <LieAlgebraRegularVectorFields>`\n on `\\CC^{\\times}`.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n\n REFERENCES:\n\n - :wikipedia:`Virasoro_algebra`\n '
def __init__(self, R):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: TestSuite(d).run()\n '
cat = LieAlgebras(R).WithBasis().Graded()
InfinitelyGeneratedLieAlgebra.__init__(self, R, index_set=ZZ, category=cat)
IndexedGenerators.__init__(self, ZZ, prefix='d', bracket='[', sorting_key=_basis_key)
def _basis_key(self, m):
"\n Return a key for sorting for the index ``m``.\n\n TESTS::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d._basis_key(3)\n 3\n sage: d._basis_key('c')\n +Infinity\n sage: d._basis_key(4) < d._basis_key('c')\n True\n "
return _basis_key(m)
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d._repr_term('c')\n 'c'\n sage: d._repr_term(2)\n 'd[2]'\n "
if isinstance(m, str):
return m
return IndexedGenerators._repr_generator(self, m)
def _latex_term(self, m):
"\n Return a `\\LaTeX` representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d._latex_term('c')\n 'c'\n sage: d._latex_term(2)\n 'd_{2}'\n sage: d._latex_term(-13)\n 'd_{-13}'\n "
if isinstance(m, str):
return m
return IndexedGenerators._latex_generator(self, m)
def _unicode_art_term(self, m):
"\n Return a unicode art representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d._unicode_art_term('c')\n c\n sage: d._unicode_art_term(2)\n d₂\n sage: d._unicode_art_term(-13)\n d₋₁₃\n "
from sage.typeset.unicode_art import unicode_art, unicode_subscript
if isinstance(m, str):
return unicode_art(m)
return unicode_art(('d' + unicode_subscript(m)))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: lie_algebras.VirasoroAlgebra(QQ)\n The Virasoro algebra over Rational Field\n '
return 'The Virasoro algebra over {}'.format(self.base_ring())
@cached_method
def lie_algebra_generators(self):
'\n Return the generators of ``self`` as a Lie algebra.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.lie_algebra_generators()\n Lazy family (generator map(i))_{i in Integer Ring}\n '
return Family(self._indices, self.monomial, name='generator map')
@cached_method
def basis(self):
"\n Return a basis of ``self``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: B = d.basis(); B\n Lazy family (basis map(i))_{i in Disjoint union of\n Family ({'c'}, Integer Ring)}\n sage: B['c']\n c\n sage: B[3]\n d[3]\n sage: B[-15]\n d[-15]\n "
I = DisjointUnionEnumeratedSets([Set(['c']), ZZ])
return Family(I, self.monomial, name='basis map')
def d(self, i):
'\n Return the element `d_i` in ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: L.d(2)\n d[2]\n '
return self.monomial(i)
def c(self):
'\n The central element `c` in ``self``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.c()\n c\n '
return self.monomial('c')
def bracket_on_basis(self, i, j):
"\n Return the bracket of basis elements indexed by ``x`` and ``y``\n where ``x < y``.\n\n (This particular implementation actually does not require\n ``x < y``.)\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.bracket_on_basis('c', 2)\n 0\n sage: d.bracket_on_basis(2, -2)\n 4*d[0] + 1/2*c\n "
if ((i == 'c') or (j == 'c')):
return self.zero()
ret = self._from_dict({(i + j): (i - j)})
R = self.base_ring()
if (i == (- j)):
ret += ((R(((i ** 3) - i)) / R(12)) * self.c())
return ret
def degree_on_basis(self, i):
"\n Return the degree of the basis element indexed by ``i``,\n which is ``i`` and `0` for ``'c'``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.degree_on_basis(2)\n 2\n sage: d.c().degree()\n 0\n sage: (d.c() + d.basis()[0]).is_homogeneous()\n True\n "
if (i == 'c'):
return ZZ.zero()
return i
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.an_element()\n d[-1] + d[0] - 1/2*d[1] + c\n '
d = self.monomial
return (((d(0) - (self.base_ring().an_element() * d(1))) + d((- 1))) + d('c'))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: d = lie_algebras.VirasoroAlgebra(QQ)\n sage: d.some_elements()\n [d[0], d[2], d[-2], c, d[-1] + d[0] - 1/2*d[1] + c]\n '
d = self.monomial
return [d(0), d(2), d((- 2)), d('c'), self.an_element()]
def chargeless_representation(self, a, b):
'\n Return the chargeless representation of ``self`` with\n parameters ``a`` and ``b``.\n\n .. SEEALSO::\n\n :class:`~sage.algebras.lie_algebras.virasoro.ChargelessRepresentation`\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: L.chargeless_representation(3, 2)\n Chargeless representation (3, 2) of\n The Virasoro algebra over Rational Field\n '
return ChargelessRepresentation(self, a, b)
def verma_module(self, c, h):
'\n Return the Verma module with central charge ``c`` and\n conformal (or highest) weight ``h``.\n\n .. SEEALSO::\n\n :class:`~sage.algebras.lie_algebras.virasoro.VermaModule`\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: L.verma_module(3, 2)\n Verma module with charge 3 and conformal weight 2 of\n The Virasoro algebra over Rational Field\n '
return VermaModule(self, c, h)
class Element(LieAlgebraElement):
pass
|
class ChargelessRepresentation(CombinatorialFreeModule):
'\n A chargeless representation of the Virasoro algebra.\n\n Let `L` be the Virasoro algebra over the field `F` of\n characteristic `0`. For `\\alpha, \\beta \\in R`, we denote `V_{a,b}`\n as the `(a, b)`-*chargeless representation* of `L`, which is the\n `F`-span of `\\{v_k \\mid k \\in \\ZZ\\}` with `L` action\n\n .. MATH::\n\n \\begin{aligned}\n d_n \\cdot v_k & = (a n + b - k) v_{n+k},\n \\\\ c \\cdot v_k & = 0,\n \\end{aligned}\n\n This comes from the action of `d_n = -t^{n+1} \\frac{d}{dt}` on\n `F[t, t^{-1}]` (recall that `L` is the central extension of the\n :class:`algebra of derivations <LieAlgebraRegularVectorFields>`\n of `F[t, t^{-1}]`), where\n\n .. MATH::\n\n V_{a,b} = F[t, t^{-1}] t^{a-b} (dt)^{-a}\n\n and `v_k = t^{a-b+k} (dz)^{-a}`.\n\n The chargeless representations are either irreducible or\n contains exactly two simple subquotients, one of which is the\n trivial representation and the other is `F[t, t^{-1}] / F`.\n The non-trivial simple subquotients are called the\n *intermediate series*.\n\n The module `V_{a,b}` is irreducible if and only if\n `a \\neq 0, -1` or `b \\notin \\ZZ`. When `a = 0` and `b \\in \\ZZ`,\n then there exists a subrepresentation isomorphic to the trivial\n representation. If `a = -1` and `b \\in \\ZZ`, then there exists\n a subrepresentation `V` such that `V_{a,b} / V` is isomorphic\n to `K \\frac{dt}{t}` and `V` is irreducible.\n\n In characteristic `p`, the non-trivial simple subquotient\n is isomorphic to `F[t, t^{-1}] / F[t^p, t^{-p}]`. For\n `p \\neq 2,3`, then the action is given as above.\n\n EXAMPLES:\n\n We first construct the irreducible `V_{1/2, 3/4}` and do some\n basic computations::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: d = L.basis()\n sage: v = M.basis()\n sage: d[3] * v[2]\n 1/4*v[5]\n sage: d[3] * v[-1]\n 13/4*v[2]\n sage: (d[3] - d[-2]) * (v[-1] + 1/2*v[0] - v[4])\n -3/4*v[-3] + 1/8*v[-2] - v[2] + 9/8*v[3] + 7/4*v[7]\n\n We construct the reducible `V_{0,2}` and the trivial\n subrepresentation given by the span of `v_2`. We verify\n this for `\\{d_i \\mid -10 \\leq i < 10\\}`::\n\n sage: M = L.chargeless_representation(0, 2)\n sage: v = M.basis()\n sage: all(d[i] * v[2] == M.zero() for i in range(-10, 10))\n True\n\n REFERENCES:\n\n - [Mat1992]_\n - [IK2010]_\n '
def __init__(self, V, a, b):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: TestSuite(M).run()\n '
self._a = a
self._b = b
self._V = V
R = V.base_ring()
if (R.characteristic() in [2, 3]):
raise NotImplementedError('not implemented for characteristic 2,3')
cat = Modules(R).WithBasis().Graded()
CombinatorialFreeModule.__init__(self, R, ZZ, prefix='v', category=cat)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: L.chargeless_representation(1/2, 3/4)\n Chargeless representation (1/2, 3/4) of\n The Virasoro algebra over Rational Field\n '
return 'Chargeless representation ({}, {}) of {}'.format(self._a, self._b, self._V)
def parameters(self):
'\n Return the parameters `(a, b)` of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: M.parameters()\n (1/2, 3/4)\n '
return (self._a, self._b)
def virasoro_algebra(self):
'\n Return the Virasoro algebra ``self`` is a representation of.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: M.virasoro_algebra() is L\n True\n '
return self._V
def degree_on_basis(self, i):
'\n Return the degree of the basis element indexed by ``i``,\n which is `i`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: M.degree_on_basis(-3)\n -3\n '
return i
class Element(CombinatorialFreeModule.Element):
def _acted_upon_(self, scalar, self_on_left=False):
'\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: d = L.basis()\n sage: M = L.chargeless_representation(1/2, 3/4)\n sage: x = d[-5] * M.an_element() + M.basis()[10]; x\n -9/4*v[-6] - 7/4*v[-5] - 33/4*v[-4] + v[10]\n sage: d[2] * x\n -279/16*v[-4] - 189/16*v[-3] - 759/16*v[-2] - 33/4*v[12]\n\n sage: v = M.basis()\n sage: all(d[i]*(d[j]*v[k]) - d[j]*(d[i]*v[k]) == d[i].bracket(d[j])*v[k]\n ....: for i in range(-5, 5) for j in range(-5, 5) for k in range(-5, 5))\n True\n '
P = self.parent()
if ((not self_on_left) and (scalar in P._V)):
scalar = P._V(scalar)
return P.sum_of_terms((((n + k), (((((P._a * n) + P._b) - k) * cv) * cm)) for (n, cv) in scalar.monomial_coefficients(copy=False).items() if (n != 'c') for (k, cm) in self.monomial_coefficients(copy=False).items()))
return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
_rmul_ = _lmul_ = _acted_upon_
|
class VermaModule(CombinatorialFreeModule):
'\n A Verma module of the Virasoro algebra.\n\n The Virasoro algebra admits a triangular decomposition\n\n .. MATH::\n\n V_- \\oplus R d_0 \\oplus R \\hat{c} \\oplus V_+,\n\n where `V_-` (resp. `V_+`) is the span of `\\{d_i \\mid i < 0\\}`\n (resp. `\\{d_i \\mid i > 0\\}`). We can construct the *Verma module*\n `M_{c,h}` as the induced representation of the `R d_0 \\oplus\n R \\hat{c} \\oplus V_+` representation `R_{c,H} = Rv`, where\n\n .. MATH::\n\n V_+ v = 0, \\qquad \\hat{c} v = c v, \\qquad d_0 v = h v.\n\n Therefore, we have a basis of `M_{c,h}`\n\n .. MATH::\n\n \\{ L_{i_1} \\cdots L_{i_k} v \\mid i_1 \\leq \\cdots \\leq i_k < 0 \\}.\n\n Moreover, the Verma modules are the free objects in the category of\n highest weight representations of `V` and are indecomposable.\n The Verma module `M_{c,h}` is irreducible for generic values of `c`\n and `h` and when it is reducible, the quotient by the maximal\n submodule is the unique irreducible highest weight representation\n `V_{c,h}`.\n\n EXAMPLES:\n\n We construct a Verma module and do some basic computations::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 0)\n sage: d = L.basis()\n sage: v = M.highest_weight_vector()\n sage: d[3] * v\n 0\n sage: d[-3] * v\n d[-3]*v\n sage: d[-1] * (d[-3] * v)\n 2*d[-4]*v + d[-3]*d[-1]*v\n sage: d[2] * (d[-1] * (d[-3] * v))\n 12*d[-2]*v + 5*d[-1]*d[-1]*v\n\n We verify that `d_{-1} v` is a singular vector for\n `\\{d_i \\mid 1 \\leq i < 20\\}`::\n\n sage: w = M.basis()[-1]; w\n d[-1]*v\n sage: all(d[i] * w == M.zero() for i in range(1,20))\n True\n\n We also verify a singular vector for `V_{-2,1}`::\n\n sage: M = L.verma_module(-2, 1)\n sage: B = M.basis()\n sage: w = B[-1,-1] - 2 * B[-2]\n sage: d = L.basis()\n sage: all(d[i] * w == M.zero() for i in range(1,20))\n True\n\n REFERENCES:\n\n - :wikipedia:`Virasoro_algebra#Representation_theory`\n '
@staticmethod
def __classcall_private__(cls, V, c, h):
'\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 1/2)\n sage: M2 = L.verma_module(int(3), 1/2)\n sage: M is M2\n True\n '
R = V.base_ring()
return super().__classcall__(cls, V, R(c), R(h))
@staticmethod
def _partition_to_neg_tuple(x):
'\n Helper function to convert a partition to an increasing\n sequence of negative numbers.\n\n EXAMPLES::\n\n sage: from sage.algebras.lie_algebras.virasoro import VermaModule\n sage: VermaModule._partition_to_neg_tuple([3,2,2,1])\n (-3, -2, -2, -1)\n '
return tuple([ZZ((- i)) for i in x])
def __init__(self, V, c, h):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 1/2)\n sage: TestSuite(M).run()\n '
self._c = c
self._h = h
self._V = V
from sage.combinat.partition import _Partitions
indices = _Partitions.map(VermaModule._partition_to_neg_tuple)
R = V.base_ring()
cat = Modules(R).WithBasis().Graded()
CombinatorialFreeModule.__init__(self, R, indices, prefix='v', category=cat)
def _repr_term(self, k):
"\n Return a string representation for the term indexed by ``k``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(1, -2)\n sage: M._repr_term((-3,-2,-2,-1))\n 'd[-3]*d[-2]*d[-2]*d[-1]*v'\n "
if (not k):
return 'v'
d = self._V.basis()
return ('*'.join((repr(d[i]) for i in k)) + '*v')
def _latex_term(self, k):
"\n Return a latex representation for the term indexed by ``k``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(1, -2)\n sage: M._latex_term((-3,-2,-2,-1))\n 'd_{-3} d_{-2} d_{-2} d_{-1} v'\n "
if (not k):
return 'v'
d = self._V.basis()
from sage.misc.latex import latex
return (' '.join((latex(d[i]) for i in k)) + ' v')
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 0)\n sage: M\n Verma module with charge 3 and conformal weight 0 of\n The Virasoro algebra over Rational Field\n '
return 'Verma module with charge {} and conformal weight {} of {}'.format(self._c, self._h, self._V)
def _monomial(self, index):
'\n TESTS::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 0)\n sage: v = M.basis()\n sage: v[-3] # indirect doctest\n d[-3]*v\n sage: v[-3,-2,-2] # indirect doctest\n d[-3]*d[-2]*d[-2]*v\n '
if (index in ZZ):
if (index >= 0):
raise ValueError('sequence must have non-positive entries')
index = (index,)
return super()._monomial(index)
def central_charge(self):
'\n Return the central charge of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 0)\n sage: M.central_charge()\n 3\n '
return self._c
def conformal_weight(self):
'\n Return the conformal weight of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(3, 0)\n sage: M.conformal_weight()\n 3\n '
return self._c
def virasoro_algebra(self):
'\n Return the Virasoro algebra ``self`` is a representation of.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(1/2, 3/4)\n sage: M.virasoro_algebra() is L\n True\n '
return self._V
@cached_method
def highest_weight_vector(self):
'\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(-2/7, 3)\n sage: M.highest_weight_vector()\n v\n '
return self.monomial(())
def _d_action_on_basis(self, n, k):
"\n Return the action of `d_n` on `v_k`.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(-2/7, 3)\n sage: M._d_action_on_basis(-3, ())\n d[-3]*v\n sage: M._d_action_on_basis(0, ())\n 3*v\n sage: M._d_action_on_basis('c', ())\n -2/7*v\n sage: M._d_action_on_basis('c', (-4,-2,-2,-1))\n -2/7*d[-4]*d[-2]*d[-2]*d[-1]*v\n sage: M._d_action_on_basis(3, (-4,-2,-2,-1))\n 7*d[-5]*d[-1]*v + 60*d[-4]*d[-2]*v + 15*d[-4]*d[-1]*d[-1]*v\n + 14*d[-3]*d[-2]*d[-1]*v + 7*d[-2]*d[-2]*d[-1]*d[-1]*v\n sage: M._d_action_on_basis(-1, (-4,-2,-2,-1))\n d[-9]*d[-1]*v + d[-5]*d[-4]*d[-1]*v + 3*d[-5]*d[-2]*d[-2]*d[-1]*v\n + 2*d[-4]*d[-3]*d[-2]*d[-1]*v + d[-4]*d[-2]*d[-2]*d[-1]*d[-1]*v\n "
if (n == 'c'):
return self.term(k, self._c)
if (not k):
if (n > 0):
return self.zero()
if (n == 0):
return self.term(k, self._h)
return self.monomial((n,))
if (n == 0):
return self.term(k, (self._h - sum(k)))
if (n <= k[0]):
return self.monomial(((n,) + k))
d = self._V.basis()
m = k[0]
k = k[1:]
return (self._d_action_on_basis(n, k)._acted_upon_(d[m], False) + self.monomial(k)._acted_upon_(d[n].bracket(d[m]), False))
def degree_on_basis(self, d):
'\n Return the degree of the basis element indexed by ``d``, which\n is the sum of the entries of ``d``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: M = L.verma_module(-2/7, 3)\n sage: M.degree_on_basis((-3,-3,-1))\n -7\n '
return sum(d)
class Element(CombinatorialFreeModule.Element):
def _acted_upon_(self, scalar, self_on_left=False):
'\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: L = lie_algebras.VirasoroAlgebra(QQ)\n sage: d = L.basis()\n sage: M = L.verma_module(1/2, 3/4)\n sage: x = d[-5] * M.an_element() + M.basis()[-10]; x\n d[-10]*v + 2*d[-5]*v + 3*d[-5]*d[-2]*v + 2*d[-5]*d[-1]*v\n sage: d[2] * x\n 12*d[-8]*v + 39/4*d[-5]*v + 14*d[-3]*v + 21*d[-3]*d[-2]*v\n + 14*d[-3]*d[-1]*v\n sage: v = M.highest_weight_vector()\n sage: d[2] * (d[-2] * v)\n 13/4*v\n\n sage: it = iter(M.basis())\n sage: B = [next(it) for _ in range(10)]\n sage: all(d[i]*(d[j]*v) - d[j]*(d[i]*v) == d[i].bracket(d[j])*v\n ....: for i in range(-5, 5) for j in range(-5, 5) for v in B)\n True\n '
P = self.parent()
if (not self_on_left):
S = scalar.parent()
R = P.base_ring()
if ((S is R) or (scalar in R)):
scalar = R(scalar)
return P._from_dict({k: (scalar * c) for (k, c) in self._monomial_coefficients.items()})
elif ((S is P._V) or (scalar in P._V)):
scalar = P._V(scalar)
return P.linear_combination(((P._d_action_on_basis(n, k), (cv * cm)) for (n, cv) in scalar.monomial_coefficients(copy=False).items() for (k, cm) in self._monomial_coefficients.items()))
return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
_rmul_ = _lmul_ = _acted_upon_
|
class AbelianLieConformalAlgebra(GradedLieConformalAlgebra):
'\n The Abelian Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring; the base ring of this Lie\n conformal algebra\n - ``ngens`` -- a positive integer (default: ``1``); the number\n of generators of this Lie conformal algebra\n - ``weights`` -- a list of positive rational numbers (default:\n ``1`` for each\n generator); the weights of the generators. The resulting\n Lie conformal algebra is `H`-graded.\n - ``parity`` -- ``None`` or a list of ``0`` or ``1`` (default:\n ``None``); The parity of the generators. If not ``None`` the\n resulting Lie Conformal algebra is a Super Lie conformal\n algebra\n - ``names`` -- a tuple of ``str`` or ``None`` (default: ``None``\n ); the list of names of the generators of this algebra.\n - ``index_set`` -- an enumerated set or ``None`` (default:\n ``None``); A set indexing the generators of this Lie\n conformal algebra.\n\n OUTPUT:\n\n The Abelian Lie conformal algebra with generators `a_i`,\n `i=1,...,n` and vanishing `\\lambda`-brackets, where `n` is\n ``ngens``.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Abelian(QQ,2); R\n The Abelian Lie conformal algebra with generators (a0, a1) over Rational Field\n sage: R.inject_variables()\n Defining a0, a1\n sage: a0.bracket(a1.T(2))\n {}\n\n TESTS::\n\n sage: R.central_elements()\n ()\n sage: R.structure_coefficients()\n Finite family {}\n\n .. TODO::\n\n implement its own class to speed up arithmetics in this\n case.\n '
def __init__(self, R, ngens=1, weights=None, parity=None, names=None, index_set=None):
'\n Initialize self.\n\n EXAMPLES::\n\n sage: V = lie_conformal_algebras.Abelian(QQ)\n sage: TestSuite(V).run()\n '
if ((names is None) and (index_set is None)):
names = 'a'
self._latex_names = tuple((('a_{%d}' % i) for i in range(ngens)))
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
abeliandict = {}
GradedLieConformalAlgebra.__init__(self, R, abeliandict, names=names, index_set=index_set, weights=weights, parity=parity)
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.Abelian(QQ)\n The Abelian Lie conformal algebra with generators (a,) over Rational Field\n '
return 'The Abelian Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
|
class AffineLieConformalAlgebra(GradedLieConformalAlgebra):
'\n The current or affine Kac-Moody Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative Ring; the base ring for this Lie\n conformal algebra.\n - ``ct`` -- a ``str`` or a :mod:`CartanType<sage.combinat.\\\n root_system.cartan_type>`; the Cartan Type for\n the corresponding finite dimensional Lie algebra. It must\n correspond to a simple finite dimensional Lie algebra.\n - ``names`` -- a list of ``str`` or ``None`` (default: ``None``)\n ; alternative names for the generators. If ``None`` the\n generators are labeled by the corresponding root and coroot\n vectors.\n - ``prefix`` -- a ``str``; parameter passed to\n :class:`IndexedGenerators<sage.structure.indexed_generators.IndexedGenerators>`\n - ``bracket`` -- a ``str``; parameter passed to\n :class:`IndexedGenerators<sage.structure.indexed_generators.IndexedGenerators>`.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Affine(QQ, \'A1\')\n sage: R\n The affine Lie conformal algebra of type [\'A\', 1] over Rational Field\n sage: R.an_element()\n B[alpha[1]] + B[alphacheck[1]] + B[-alpha[1]] + B[\'K\']\n\n sage: R = lie_conformal_algebras.Affine(QQ, \'A1\', names = (\'e\', \'h\',\'f\'))\n sage: R.inject_variables()\n Defining e, h, f, K\n sage: Family(e.bracket(f.T(3)))\n Finite family {0: 6*T^(3)h, 1: 6*T^(2)h, 2: 6*Th, 3: 6*h, 4: 24*K}\n\n sage: V = lie_conformal_algebras.Affine(QQ, CartanType(["A",2,1]))\n Traceback (most recent call last):\n ...\n ValueError: only affine algebras of simple finite dimensionalLie algebras are implemented\n\n OUTPUT:\n\n The Affine Lie conformal algebra associated with the finite\n dimensional simple Lie algebra of Cartan type ``ct``.\n '
def __init__(self, R, ct, names=None, prefix=None, bracket=None):
"\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Affine(QQ,'A1')\n sage: TestSuite(V).run()\n "
if (type(ct) is str):
from sage.combinat.root_system.cartan_type import CartanType
try:
ct = CartanType(ct)
except IndexError:
raise ValueError('ct must be a valid Cartan Type')
if (not (ct.is_finite() and ct.is_irreducible)):
raise ValueError('only affine algebras of simple finite dimensionalLie algebras are implemented')
hv = Integer(ct.dual_coxeter_number())
g = LieAlgebra(R, cartan_type=ct)
B = g.basis()
S = B.keys()
gdict = {}
for k1 in S:
for k2 in S:
if (S.rank(k2) <= S.rank(k1)):
myb = B[k1].bracket(B[k2]).monomial_coefficients()
myf = ((R(2).inverse_of_unit() * R(hv).inverse_of_unit()) * g.killing_form(B[k1], B[k2]))
if (myb or myf):
gdict[(k1, k2)] = {}
if myb:
gdict[(k1, k2)][0] = {(nk, 0): v for (nk, v) in myb.items()}
if myf:
gdict[(k1, k2)][1] = {('K', 0): myf}
weights = ((1,) * B.cardinality())
self._ct = ct
if ((prefix is None) and (names is None)):
prefix = 'B'
GradedLieConformalAlgebra.__init__(self, R, gdict, index_set=S, central_elements=('K',), weights=weights, names=names, prefix=prefix, bracket=bracket)
def cartan_type(self):
"\n The Cartan type of this Lie conformal algbera.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Affine(QQ, 'B3')\n sage: R\n The affine Lie conformal algebra of type ['B', 3] over Rational Field\n sage: R.cartan_type()\n ['B', 3]\n "
return self._ct
def _repr_(self):
"\n The name of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.Affine(QQ, 'A1')\n The affine Lie conformal algebra of type ['A', 1] over Rational Field\n "
return 'The affine Lie conformal algebra of type {} over {}'.format(self._ct, self.base_ring())
|
class BosonicGhostsLieConformalAlgebra(GradedLieConformalAlgebra):
"\n The Bosonic ghosts or `\\beta-\\gamma`-system Lie conformal\n algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring.\n - ``ngens`` -- an even positive Integer (default: ``2``); the\n number of non-central generators of this Lie conformal\n algebra.\n - ``names`` -- a list of ``str``; alternative names for the\n generators\n - ``index_set`` -- an enumerated set; An indexing set for the\n generators.\n\n OUTPUT:\n\n The Bosonic Ghosts Lie conformal algebra with generators\n `\\beta_i,\\gamma_i, i=1,\\ldots,n` and `K`, where `2n` is\n ``ngens``.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.BosonicGhosts(QQ); R\n The Bosonic ghosts Lie conformal algebra with generators (beta, gamma, K) over Rational Field\n sage: R.inject_variables(); beta.bracket(gamma)\n Defining beta, gamma, K\n {0: K}\n sage: beta.degree()\n 1\n sage: gamma.degree()\n 0\n\n sage: R = lie_conformal_algebras.BosonicGhosts(QQbar, ngens = 4, names = 'abcd'); R\n The Bosonic ghosts Lie conformal algebra with generators (a, b, c, d, K) over Algebraic Field\n sage: R.structure_coefficients()\n Finite family {('a', 'c'): ((0, K),), ('b', 'd'): ((0, K),), ('c', 'a'): ((0, -K),), ('d', 'b'): ((0, -K),)}\n\n TESTS::\n\n sage: lie_conformal_algebras.BosonicGhosts(AA).category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Algebraic Real Field\n "
def __init__(self, R, ngens=2, names=None, index_set=None):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.BosonicGhosts(QQ)\n sage: TestSuite(V).run()\n '
from sage.rings.integer_ring import ZZ
try:
assert ((ngens in ZZ) and (ngens > 0) and (not (ngens % 2)))
except AssertionError:
raise ValueError(('ngens should be an even positive integer, ' + 'got {}'.format(ngens)))
latex_names = None
half = (ngens // 2)
if ((names is None) and (index_set is None)):
from sage.misc.defaults import variable_names as varnames
from sage.misc.defaults import latex_variable_names as laxnames
names = (varnames(half, 'beta') + varnames(half, 'gamma'))
latex_names = (tuple((laxnames(half, '\\beta') + laxnames(half, '\\gamma'))) + ('K',))
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
A = identity_matrix(R, half)
from sage.matrix.special import block_matrix
gram_matrix = block_matrix([[R.zero(), A], [(- A), R.zero()]])
ghostsdict = {(i, j): {0: {('K', 0): gram_matrix[(index_set.rank(i), index_set.rank(j))]}} for i in index_set for j in index_set}
weights = (((1,) * half) + ((0,) * half))
super().__init__(R, ghostsdict, names=names, latex_names=latex_names, index_set=index_set, weights=weights, central_elements=('K',))
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.BosonicGhosts(QQbar)\n The Bosonic ghosts Lie conformal algebra with generators (beta, gamma, K) over Algebraic Field\n '
return 'The Bosonic ghosts Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
|
class FermionicGhostsLieConformalAlgebra(GradedLieConformalAlgebra):
"\n The Fermionic ghosts or `bc`-system super Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring; the base ring of this Lie\n conformal algebra\n - ``ngens`` -- an even positive Integer (default: ``2``); The\n number of non-central generators of this Lie conformal\n algebra.\n - ``names`` -- a tuple of ``str``; alternative names for the\n generators\n - ``index_set`` -- an enumerated set; alternative indexing\n set for the generators.\n\n OUTPUT:\n\n The Fermionic Ghosts super Lie conformal algebra with generators\n `b_i,c_i, i=1,\\ldots,n` and `K` where `2n` is ``ngens``.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.FermionicGhosts(QQ); R\n The Fermionic ghosts Lie conformal algebra with generators (b, c, K) over Rational Field\n sage: R.inject_variables()\n Defining b, c, K\n sage: b.bracket(c) == c.bracket(b)\n True\n sage: b.degree()\n 1\n sage: c.degree()\n 0\n sage: R.category()\n Category of H-graded super finitely generated Lie conformal algebras with basis over Rational Field\n\n sage: R = lie_conformal_algebras.FermionicGhosts(QQbar, ngens=4, names = 'abcd');R\n The Fermionic ghosts Lie conformal algebra with generators (a, b, c, d, K) over Algebraic Field\n sage: R.structure_coefficients()\n Finite family {('a', 'c'): ((0, K),), ('b', 'd'): ((0, K),), ('c', 'a'): ((0, K),), ('d', 'b'): ((0, K),)}\n "
def __init__(self, R, ngens=2, names=None, index_set=None):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.BosonicGhosts(QQ)\n sage: TestSuite(V).run()\n '
try:
assert ((ngens > 0) and (not (ngens % 2)))
except AssertionError:
raise ValueError(('ngens should be an even positive integer, ' + 'got {}'.format(ngens)))
latex_names = None
half = (ngens // 2)
if ((names is None) and (index_set is None)):
from sage.misc.defaults import variable_names as varnames
from sage.misc.defaults import latex_variable_names as laxnames
names = (varnames(half, 'b') + varnames(half, 'c'))
latex_names = (tuple((laxnames(half, 'b') + laxnames(half, 'c'))) + ('K',))
from sage.structure.indexed_generators import standardize_names_index_set
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
from sage.matrix.special import identity_matrix
A = identity_matrix(R, half)
from sage.matrix.special import block_matrix
gram_matrix = block_matrix([[R.zero(), A], [A, R.zero()]])
ghostsdict = {(i, j): {0: {('K', 0): gram_matrix[(index_set.rank(i), index_set.rank(j))]}} for i in index_set for j in index_set}
weights = (((1,) * half) + ((0,) * half))
parity = ((1,) * ngens)
super().__init__(R, ghostsdict, names=names, latex_names=latex_names, index_set=index_set, weights=weights, parity=parity, central_elements=('K',))
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.FermionicGhosts(QQ)\n The Fermionic ghosts Lie conformal algebra with generators (b, c, K) over Rational Field\n '
return 'The Fermionic ghosts Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
|
class FinitelyFreelyGeneratedLCA(FreelyGeneratedLieConformalAlgebra):
'\n Abstract base class for finitely generated Lie conformal\n algebras.\n\n This class provides minimal functionality, simply sets the\n number of generators.\n '
def __init__(self, R, index_set=None, central_elements=None, category=None, element_class=None, prefix=None, names=None, latex_names=None, **kwds):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ)\n sage: TestSuite(V).run()\n '
default_category = LieConformalAlgebras(R).FinitelyGenerated()
try:
category = default_category.or_subcategory(category)
except ValueError:
category = default_category.Super().or_subcategory(category)
from sage.categories.sets_cat import Sets
if (index_set not in Sets().Finite()):
raise TypeError('index_set must be a finite set')
super().__init__(R, index_set=index_set, central_elements=central_elements, category=category, element_class=element_class, prefix=prefix, **kwds)
self._ngens = len(self._generators)
self._names = names
self._latex_names = latex_names
def _repr_(self):
"\n The name of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: bosondict = {('a','a'):{1:{('K',0):1}}}\n sage: R = LieConformalAlgebra(QQ,bosondict,names=('a',),central_elements=('K',))\n sage: R\n Lie conformal algebra with generators (a, K) over Rational Field\n "
if (self._ngens == 1):
return 'Lie conformal algebra generated by {0} over {1}'.format(self.gen(0), self.base_ring())
return 'Lie conformal algebra with generators {0} over {1}'.format(self.gens(), self.base_ring())
def _an_element_(self):
'\n An element of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.NeveuSchwarz(QQ); R.an_element()\n L + G + C\n '
return self.sum(self.gens())
def ngens(self):
"\n The number of generators of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ); Vir.ngens()\n 2\n sage: V = lie_conformal_algebras.Affine(QQ, 'A1'); V.ngens()\n 4\n "
return self._ngens
@cached_method
def gens(self):
'\n The generators for this Lie conformal algebra.\n\n OUTPUT:\n\n This method returns a tuple with the (finite) generators\n of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ);\n sage: Vir.gens()\n (L, C)\n\n .. SEEALSO::\n\n :meth:`lie_conformal_algebra_generators< FreelyGeneratedLieConformalAlgebra. lie_conformal_algebra_generators>`\n '
return self.lie_conformal_algebra_generators()
@cached_method
def central_elements(self):
'\n The central elements of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.NeveuSchwarz(QQ); R.central_elements()\n (C,)\n '
return tuple(FreelyGeneratedLieConformalAlgebra.central_elements(self))
|
class FreeBosonsLieConformalAlgebra(GradedLieConformalAlgebra):
"\n The Free Bosons Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring.\n - ``ngens`` -- a positive Integer (default ``1``); the number of\n non-central generators of this Lie conformal algebra.\n - ``gram_matrix``: a symmetric square matrix with coefficients\n in ``R`` (default: ``identity_matrix(ngens)``); the Gram\n matrix of the inner product\n - ``names`` -- a tuple of ``str``; alternative names for the\n generators\n - ``index_set`` -- an enumerated set; alternative indexing set\n for the generators.\n\n OUTPUT:\n\n The Free Bosons Lie conformal algebra with generators\n `\\alpha_i`, `i=1,...,n` and `\\lambda`-brackets\n\n .. MATH::\n\n [{\\alpha_i}_{\\lambda} \\alpha_j] = \\lambda M_{ij} K,\n\n where `n` is the number of generators ``ngens`` and `M` is\n the ``gram_matrix``. This Lie conformal\n algebra is `H`-graded where every generator has conformal weight\n `1`.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.FreeBosons(AA); R\n The free Bosons Lie conformal algebra with generators (alpha, K) over Algebraic Real Field\n sage: R.inject_variables()\n Defining alpha, K\n sage: alpha.bracket(alpha)\n {1: K}\n sage: M = identity_matrix(QQ,2); R = lie_conformal_algebras.FreeBosons(QQ,gram_matrix=M, names='alpha,beta'); R\n The free Bosons Lie conformal algebra with generators (alpha, beta, K) over Rational Field\n sage: R.inject_variables(); alpha.bracket(beta)\n Defining alpha, beta, K\n {}\n sage: alpha.bracket(alpha)\n {1: K}\n sage: R = lie_conformal_algebras.FreeBosons(QQbar, ngens=3); R\n The free Bosons Lie conformal algebra with generators (alpha0, alpha1, alpha2, K) over Algebraic Field\n\n TESTS::\n sage: R = lie_conformal_algebras.FreeBosons(QQ); R.0.degree()\n 1\n sage: R = lie_conformal_algebras.FreeBosons(QQbar, ngens=2, gram_matrix=identity_matrix(QQ,1,1))\n Traceback (most recent call last):\n ...\n ValueError: the gram_matrix should be a symmetric 2 x 2 matrix, got [1]\n sage: R = lie_conformal_algebras.FreeBosons(QQbar, ngens=2, gram_matrix=Matrix(QQ,[[0,1],[-1,0]]))\n Traceback (most recent call last):\n ...\n ValueError: the gram_matrix should be a symmetric 2 x 2 matrix, got [ 0 1]\n [-1 0]\n "
def __init__(self, R, ngens=None, gram_matrix=None, names=None, index_set=None):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.FreeBosons(QQ)\n sage: TestSuite(V).run()\n '
from sage.matrix.matrix_space import MatrixSpace
if (gram_matrix is not None):
if (ngens is None):
ngens = gram_matrix.dimensions()[0]
try:
assert (gram_matrix in MatrixSpace(R, ngens, ngens))
except AssertionError:
raise ValueError(('the gram_matrix should be a symmetric ' + '{0} x {0} matrix, got {1}'.format(ngens, gram_matrix)))
if (not gram_matrix.is_symmetric()):
raise ValueError(('the gram_matrix should be a symmetric ' + '{0} x {0} matrix, got {1}'.format(ngens, gram_matrix)))
else:
if (ngens is None):
ngens = 1
gram_matrix = identity_matrix(R, ngens, ngens)
latex_names = None
if ((names is None) and (index_set is None)):
names = 'alpha'
latex_names = (tuple((('\\alpha_{%d}' % i) for i in range(ngens))) + ('K',))
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
bosondict = {(i, j): {1: {('K', 0): gram_matrix[(index_set.rank(i), index_set.rank(j))]}} for i in index_set for j in index_set}
GradedLieConformalAlgebra.__init__(self, R, bosondict, names=names, latex_names=latex_names, index_set=index_set, central_elements=('K',))
self._gram_matrix = gram_matrix
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.FreeBosons(AA)\n The free Bosons Lie conformal algebra with generators (alpha, K) over Algebraic Real Field\n '
return 'The free Bosons Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
def gram_matrix(self):
'\n The Gram matrix that specifies the `\\lambda`-brackets of the\n generators.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.FreeBosons(QQ,ngens=2);\n sage: R.gram_matrix()\n [1 0]\n [0 1]\n '
return self._gram_matrix
|
class FreeFermionsLieConformalAlgebra(GradedLieConformalAlgebra):
'\n The Free Fermions Super Lie conformal algebra.\n\n INPUT:\n\n - ``R``: a commutative ring.\n - ``ngens``: a positive Integer (default ``1``); the number of\n non-central generators of this Lie conformal algebra.\n - ``gram_matrix``: a symmetric square matrix with coefficients\n in ``R`` (default: ``identity_matrix(ngens)``); the Gram\n matrix of the inner product\n\n OUTPUT:\n\n The Free Fermions Lie conformal algebra with generators\n `\\psi_i`, `i=1,...,n` and `\\lambda`-brackets\n\n .. MATH::\n\n [{\\psi_i}_{\\lambda} \\psi_j] = M_{ij} K,\n\n where `n` is the number of generators ``ngens`` and `M` is the\n ``gram_matrix``. This super Lie conformal\n algebra is `H`-graded where every generator has degree `1/2`.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.FreeFermions(QQbar); R\n The free Fermions super Lie conformal algebra with generators (psi, K) over Algebraic Field\n sage: R.inject_variables()\n Defining psi, K\n sage: psi.bracket(psi)\n {0: K}\n\n sage: R = lie_conformal_algebras.FreeFermions(QQbar,gram_matrix=Matrix([[0,1],[1,0]])); R\n The free Fermions super Lie conformal algebra with generators (psi_0, psi_1, K) over Algebraic Field\n sage: R.inject_variables()\n Defining psi_0, psi_1, K\n sage: psi_0.bracket(psi_1)\n {0: K}\n sage: psi_0.degree()\n 1/2\n sage: R.category()\n Category of H-graded super finitely generated Lie conformal algebras with basis over Algebraic Field\n '
def __init__(self, R, ngens=None, gram_matrix=None, names=None, index_set=None):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.FreeFermions(QQ)\n sage: TestSuite(V).run()\n '
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.special import identity_matrix
if (gram_matrix is not None):
if (ngens is None):
ngens = gram_matrix.dimensions()[0]
try:
assert (gram_matrix in MatrixSpace(R, ngens, ngens))
except AssertionError:
raise ValueError(('The gram_matrix should be a symmetric ' + '{0} x {0} matrix, got {1}'.format(ngens, gram_matrix)))
if (not gram_matrix.is_symmetric()):
raise ValueError(('The gram_matrix should be a symmetric ' + '{0} x {0} matrix, got {1}'.format(ngens, gram_matrix)))
else:
if (ngens is None):
ngens = 1
gram_matrix = identity_matrix(R, ngens, ngens)
latex_names = None
if ((names is None) and (index_set is None)):
if (ngens == 1):
names = 'psi'
else:
names = 'psi_'
latex_names = (tuple((('\\psi_{%d}' % i) for i in range(ngens))) + ('K',))
from sage.structure.indexed_generators import standardize_names_index_set
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
fermiondict = {(i, j): {0: {('K', 0): gram_matrix[(index_set.rank(i), index_set.rank(j))]}} for i in index_set for j in index_set}
from sage.rings.rational_field import QQ
weights = ((QQ((1 / 2)),) * ngens)
parity = ((1,) * ngens)
GradedLieConformalAlgebra.__init__(self, R, fermiondict, names=names, latex_names=latex_names, index_set=index_set, weights=weights, parity=parity, central_elements=('K',))
self._gram_matrix = gram_matrix
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.FreeFermions(QQ)\n The free Fermions super Lie conformal algebra with generators (psi, K) over Rational Field\n '
return 'The free Fermions super Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
def gram_matrix(self):
'\n The Gram matrix that specifies the `\\lambda`-brackets of the\n generators.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.FreeFermions(QQ,ngens=2);\n sage: R.gram_matrix()\n [1 0]\n [0 1]\n '
return self._gram_matrix
|
class FreelyGeneratedLieConformalAlgebra(LieConformalAlgebraWithBasis):
'\n Base class for a central extension of a freely generated Lie\n conformal algebra.\n\n This class provides minimal functionality, it sets up the\n family of Lie conformal algebra generators.\n\n .. NOTE::\n\n We now only accept direct sums of free modules plus\n some central generators `C_i` such that `TC_i = 0`.\n '
def __init__(self, R, index_set=None, central_elements=None, category=None, element_class=None, prefix=None, **kwds):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ)\n sage: TestSuite(V).run()\n '
self._generators = Family(index_set)
E = cartesian_product([index_set, NonNegativeIntegers()])
if (central_elements is not None):
self._generators = DisjointUnionEnumeratedSets([index_set, Family(central_elements)])
E = DisjointUnionEnumeratedSets((cartesian_product([Family(central_elements), {Integer(0)}]), E))
super().__init__(R, basis_keys=E, element_class=element_class, category=category, prefix=prefix, **kwds)
if (central_elements is not None):
self._central_elements = Family(central_elements)
else:
self._central_elements = ()
def lie_conformal_algebra_generators(self):
"\n The generators of this Lie conformal algebra.\n\n OUTPUT: a (possibly infinite) family of generators (as an\n `R[T]`-module) of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ)\n sage: Vir.lie_conformal_algebra_generators()\n (L, C)\n sage: V = lie_conformal_algebras.Affine(QQ,'A1')\n sage: V.lie_conformal_algebra_generators()\n (B[alpha[1]], B[alphacheck[1]], B[-alpha[1]], B['K'])\n "
F = Family(self._generators, (lambda i: self.monomial((i, Integer(0)))), name='generator map')
from sage.categories.sets_cat import Sets
if (F in Sets().Finite()):
return tuple(F)
return F
def central_elements(self):
"\n The central generators of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ)\n sage: Vir.central_elements()\n (C,)\n sage: V = lie_conformal_algebras.Affine(QQ, 'A1')\n sage: V.central_elements()\n (B['K'],)\n "
return Family(self._central_elements, (lambda i: self.monomial((i, Integer(0)))), name='central_element map')
|
class GradedLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients):
"\n An H-Graded Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring (default: ``None``); the base\n ring of this Lie conformal algebra. Behaviour is undefined if\n it is not a field of characteristic zero\n\n - ``s_coeff`` -- a dictionary (default: ``None``); as in the\n input of :class:`LieConformalAlgebra`\n\n - ``names`` -- tuple of ``str`` (default: ``None``); as in the\n input of :class:`LieConformalAlgebra`\n\n - ``central_elements`` -- tuple of ``str`` (default: ``None``);\n as in the input of :class:`LieConformalAlgebra`\n\n - ``index_set`` -- enumerated set (default: ``None``); as in the\n input of :class:`LieConformalAlgebra`\n\n - ``weights`` -- tuple of non-negative rational numbers\n (default: tuple of ``1``); a list of degrees for this Lie\n conformal algebra.\n This tuple needs to have the same cardinality as\n ``index_set`` or ``names``. Central elements are assumed\n to have weight ``0``.\n\n - ``category`` The category that this Lie conformal algebra\n belongs to.\n\n - ``parity`` -- tuple of ``0`` or ``1`` (Default: tuple of\n ``0``); a tuple specifying the parity of each non-central\n generator.\n\n EXAMPLES::\n\n sage: bosondict = {('a','a'):{1:{('K',0):1}}}\n sage: R = LieConformalAlgebra(QQ,bosondict,names=('a',),central_elements=('K',), weights=(1,))\n sage: R.inject_variables()\n Defining a, K\n sage: a.T(3).degree()\n 4\n sage: K.degree()\n 0\n sage: R.category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Rational Field\n "
def __init__(self, R, s_coeff, index_set=None, central_elements=None, category=None, prefix=None, names=None, latex_names=None, parity=None, weights=None, **kwds):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ)\n sage: TestSuite(V).run()\n '
is_super = kwds.get('super', None)
default_category = LieConformalAlgebras(R).WithBasis().FinitelyGenerated().Graded()
if (is_super or parity):
category = default_category.Super().or_subcategory(category)
else:
category = default_category.or_subcategory(category)
LieConformalAlgebraWithStructureCoefficients.__init__(self, R, s_coeff, index_set=index_set, central_elements=central_elements, category=category, prefix=prefix, names=names, latex_names=latex_names, parity=parity, **kwds)
if (weights is None):
weights = ((1,) * (len(self._generators) - len(self.central_elements())))
if (len(weights) != (len(self._generators) - len(self.central_elements()))):
raise ValueError('weights and (non-central) generator lists must be of same length')
self._weights = weights
|
class LieConformalAlgebra(UniqueRepresentation, Parent):
"\n Lie Conformal Algebras base class and factory.\n\n INPUT:\n\n - ``R`` -- a commutative ring (default: ``None``); the base\n ring of this Lie conformal algebra. Behaviour is undefined\n if it is not a field of characteristic zero.\n\n - ``arg0`` -- a dictionary (default: ``None``);\n a dictionary containing the `\\lambda` brackets of the\n generators of this Lie conformal algebra. The keys of this\n dictionary are pairs of either names or indices of the\n generators and the values are themselves dictionaries. For a\n pair of generators ``'a'`` and ``'b'``, the value of\n ``arg0[('a','b')]`` is a dictionary whose keys are positive\n integer numbers and the corresponding value for the\n key ``j`` is a dictionary itself representing the j-th product\n `a_{(j)}b`. Thus, for a positive integer number `j`, the\n value of ``arg0[('a','b')][j]`` is a dictionary whose entries\n are pairs ``('c',n)`` where ``'c'`` is the name of a generator\n and ``n`` is a positive number. The value for this key is the\n coefficient of `\\frac{T^{n}}{n!} c` in `a_{(j)}b`. For\n example the ``arg0`` for the *Virasoro* Lie conformal algebra\n is::\n\n {('L','L'):{0:{('L',1):1}, 1:{('L',0):2}, 3:{('C',0):1/2}}}\n\n\n Do not include central elements as keys in this dictionary. Also,\n if the key ``('a','b')`` is present, there is no need to include\n ``('b','a')`` as it is defined by skew-symmetry. Any missing\n pair (besides the ones defined by skew-symmetry) is assumed\n to have vanishing `\\lambda`-bracket.\n\n - ``names`` -- tuple of ``str`` (default: ``None``); the list of\n names for generators of this Lie conformal algebra. Do not\n include central elements in this list.\n\n - ``central_elements`` -- tuple of ``str`` (default: ``None``);\n A list of names for central elements of this Lie conformal\n algebra.\n\n - ``index_set`` -- enumerated set (default: ``None``); an\n indexing set for the generators of this Lie conformal algebra.\n Do not include central elements in this list.\n\n - ``weights`` -- tuple of non-negative rational numbers\n (default: ``None``); a list of degrees for this Lie\n conformal algebra.\n The returned Lie conformal algebra is H-Graded. This tuple\n needs to have the same cardinality as ``index_set`` or\n ``names``. Central elements are assumed to have weight `0`.\n\n - ``parity`` -- tuple of `0` or `1` (default: tuple of `0`);\n if this is a super Lie conformal algebra, this tuple\n specifies the parity of each of the non-central generators of\n this Lie conformal algebra. Central elements are assumed to\n be even. Notice that if this tuple is present, the category\n of this Lie conformal algebra is set to be a subcategory of\n ``LieConformalAlgebras(R).Super()``, even if all generators\n are even.\n\n - ``category`` The category that this Lie conformal algebra\n belongs to.\n\n In addition we accept the following keywords:\n\n - ``graded`` -- a boolean (default: ``False``);\n if ``True``, the returned algebra is H-Graded.\n If ``weights`` is not specified, all non-central generators\n are assigned degree `1`. This keyword is ignored if\n ``weights`` is specified\n\n - ``super`` -- a boolean (default: ``False``);\n if ``True``, the returned algebra is a super\n Lie conformal algebra even if all generators are even.\n If ``parity`` is not specified, all generators are\n assigned even parity. This keyword is ignored if\n ``parity`` is specified.\n\n .. Note::\n\n Any remaining keyword is currently passed to\n :class:`CombinatorialFreeModule<sage.combinat.free_module.CombinatorialFreeModule>`.\n\n EXAMPLES:\n\n We construct the `\\beta-\\gamma` system or *Weyl* Lie conformal\n algebra::\n\n sage: betagamma_dict = {('b','a'):{0:{('K',0):1}}}\n sage: V = LieConformalAlgebra(QQbar, betagamma_dict, names=('a','b'), weights=(1,0), central_elements=('K',))\n sage: V.category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Algebraic Field\n sage: V.inject_variables()\n Defining a, b, K\n sage: a.bracket(b)\n {0: -K}\n\n We construct the current algebra for `\\mathfrak{sl}_2`::\n\n sage: sl2dict = {('e','f'):{0:{('h',0):1}, 1:{('K',0):1}}, ('e','h'):{0:{('e',0):-2}}, ('f','h'):{0:{('f',0):2}}, ('h', 'h'):{1:{('K', 0):2}}}\n sage: V = LieConformalAlgebra(QQ, sl2dict, names=('e', 'h', 'f'), central_elements=('K',), graded=True)\n sage: V.inject_variables()\n Defining e, h, f, K\n sage: e.bracket(f)\n {0: h, 1: K}\n sage: h.bracket(e)\n {0: 2*e}\n sage: e.bracket(f.T())\n {0: Th, 1: h, 2: 2*K}\n sage: V.category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Rational Field\n sage: e.degree()\n 1\n\n .. TODO::\n\n This class checks that the provided dictionary is consistent\n with skew-symmetry. It does not check that it is consistent\n with the Jacobi identity.\n\n .. SEEALSO::\n\n :mod:`sage.algebras.lie_conformal_algebras.graded_lie_conformal_algebra`\n "
@staticmethod
def __classcall_private__(cls, R=None, arg0=None, index_set=None, central_elements=None, category=None, prefix=None, names=None, latex_names=None, parity=None, weights=None, **kwds):
"\n Lie conformal algebra factory.\n\n EXAMPLES::\n\n sage: betagamma_dict = {('b','a'):{0:{('K',0):1}}}\n sage: V = LieConformalAlgebra(QQ, betagamma_dict, names=('a','b'), weights=(1,0), central_elements=('K',))\n sage: type(V)\n <class 'sage.algebras.lie_conformal_algebras.graded_lie_conformal_algebra.GradedLieConformalAlgebra_with_category'>\n "
if (R not in CommutativeRings()):
raise ValueError(f'arg0 must be a commutative ring got {R}')
known_keywords = ['category', 'prefix', 'bracket', 'latex_bracket', 'string_quotes', 'sorting_key', 'graded', 'super']
for key in kwds:
if (key not in known_keywords):
raise ValueError(("got an unexpected keyword argument '%s'" % key))
if (isinstance(arg0, dict) and arg0):
graded = kwds.pop('graded', False)
if ((weights is not None) or graded):
from .graded_lie_conformal_algebra import GradedLieConformalAlgebra
return GradedLieConformalAlgebra(R, Family(arg0), index_set=index_set, central_elements=central_elements, category=category, prefix=prefix, names=names, latex_names=latex_names, parity=parity, weights=weights, **kwds)
else:
from .lie_conformal_algebra_with_structure_coefs import LieConformalAlgebraWithStructureCoefficients
return LieConformalAlgebraWithStructureCoefficients(R, Family(arg0), index_set=index_set, central_elements=central_elements, category=category, prefix=prefix, names=names, latex_names=latex_names, parity=parity, **kwds)
raise NotImplementedError('not implemented')
|
class LCAWithGeneratorsElement(IndexedFreeModuleElement):
'\n The element class of a Lie conformal algebra with a\n preferred set of generators.\n '
def T(self, n=1):
'\n The n-th derivative of this element.\n\n INPUT:\n\n - ``n`` -- a non-negative integer (default:``1``); how many\n times to apply `T` to this element.\n\n We use the *divided powers* notation\n `T^{(j)} = \\frac{T^j}{j!}`.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ)\n sage: Vir.inject_variables()\n Defining L, C\n sage: L.T()\n TL\n sage: L.T(3)\n 6*T^(3)L\n sage: C.T()\n 0\n\n sage: R = lie_conformal_algebras.NeveuSchwarz(QQbar); R.inject_variables()\n Defining L, G, C\n sage: (L + 2*G.T() + 4*C).T(2)\n 2*T^(2)L + 12*T^(3)G\n '
from sage.rings.integer_ring import ZZ
if ((n not in ZZ) or (n < 0)):
raise ValueError('n must be a nonnegative Integer')
if ((n == 0) or self.is_zero()):
return self
if self.is_monomial():
p = self.parent()
(a, m) = self.index()
coef = self._monomial_coefficients[(a, m)]
if ((a, (m + n)) in p._indices):
return ((coef * prod(range((m + 1), ((m + n) + 1)))) * p.monomial((a, (m + n))))
else:
return p.zero()
return sum((mon.T(n) for mon in self.terms()))
def is_monomial(self):
'\n Whether this element is a monomial.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ); L = Vir.0\n sage: (L + L.T()).is_monomial()\n False\n sage: L.T().is_monomial()\n True\n '
return ((len(self._monomial_coefficients) == 1) or self.is_zero())
|
class LCAStructureCoefficientsElement(LCAWithGeneratorsElement):
'\n An element of a Lie conformal algebra given by structure\n coefficients.\n '
def _bracket_(self, right):
"\n The lambda bracket of these two elements.\n\n The result is a dictionary with non-negative integer keys.\n The value corresponding to the entry `j` is ``self_{(j)}right``.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ); L = Vir.0\n sage: L.bracket(L)\n {0: TL, 1: 2*L, 3: 1/2*C}\n sage: L.T().bracket(L)\n {1: -TL, 2: -4*L, 4: -2*C}\n\n sage: R = lie_conformal_algebras.Affine(QQbar, 'A1', names=('e','h','f')); R\n The affine Lie conformal algebra of type ['A', 1] over Algebraic Field\n sage: R.inject_variables()\n Defining e, h, f, K\n sage: e.bracket(f)\n {0: h, 1: K}\n sage: h.bracket(h.T())\n {2: 4*K}\n "
p = self.parent()
if (self.is_monomial() and right.is_monomial()):
if (self.is_zero() or right.is_zero()):
return {}
s_coeff = p._s_coeff
(a, k) = self.index()
coefa = self.monomial_coefficients()[(a, k)]
(b, m) = right.index()
coefb = right.monomial_coefficients()[(b, m)]
try:
mbr = dict(s_coeff[(a, b)])
except KeyError:
return {}
pole = max(mbr.keys())
ret = {l: ((((coefa * coefb) * ((- 1) ** k)) / factorial(k)) * sum((((((factorial(l) / factorial((((m + k) + j) - l))) / factorial(((l - k) - j))) / factorial(j)) * mbr[j].T((((m + k) + j) - l))) for j in mbr if (((l - m) - k) <= j <= (l - k))))) for l in range((((m + k) + pole) + 1))}
return {k: v for (k, v) in ret.items() if v}
diclist = [i._bracket_(j) for i in self.terms() for j in right.terms()]
ret = {}
pz = p.zero()
for d in diclist:
for k in d:
ret[k] = (ret.get(k, pz) + d[k])
return {k: v for (k, v) in ret.items() if v}
def _repr_(self):
"\n A visual representation of this element.\n\n For a free generator `L`, the element `\\frac{T^{j}}{j!}L` is\n denoted by ``T^(j)L``.\n\n EXAMPLES::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ); V.inject_variables()\n Defining L, C\n sage: v = L.T(5).nproduct(L,6); v\n -1440*L\n sage: L.T(2) + L + C\n 2*T^(2)L + L + C\n sage: L.T(4)\n 24*T^(4)L\n\n sage: R = lie_conformal_algebras.Affine(QQ, 'B3')\n sage: R.2.T()+3*R.3\n TB[alpha[1]] + 3*B[alpha[2] + alpha[3]]\n "
if self.is_zero():
return '0'
p = self.parent()
if p._names:
terms = [(('T^({}){}'.format(k1, p._names[p._index_to_pos[k0]]), v) if (k1 > 1) else (('T{}'.format(p._names[p._index_to_pos[k0]]), v) if (k1 == 1) else ('{}'.format(p._names[p._index_to_pos[k0]]), v))) for ((k0, k1), v) in self.monomial_coefficients().items()]
else:
terms = [(('T^({}){}'.format(k1, p._repr_generator(k0)), v) if (k1 > 1) else (('T{}'.format(p._repr_generator(k0)), v) if (k1 == 1) else ('{}'.format(p._repr_generator(k0)), v))) for ((k0, k1), v) in self.monomial_coefficients().items()]
return repr_lincomb(terms, strip_one=True)
def _latex_(self):
"\n A visual representation of this element.\n\n For a free generator `L`, the element `\\frac{T^{j}}{j!}L` is\n denoted by ``T^(j)L``.\n\n EXAMPLES::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ); V.inject_variables()\n Defining L, C\n sage: latex(L.T(2))\n 2 T^{(2)}L\n\n sage: R = lie_conformal_algebras.Affine(QQbar, 'A1', names=('e','h','f')); R.inject_variables()\n Defining e, h, f, K\n sage: latex(e.bracket(f))\n \\left\\{0 : h, 1 : K\\right\\}\n sage: latex(e.T(3))\n 6 T^{(3)}e\n\n sage: R = lie_conformal_algebras.Affine(QQbar, 'A1')\n sage: latex(R.0.bracket(R.2))\n \\left\\{0 : \\alpha^\\vee_{1}, 1 : \\text{\\texttt{K}}\\right\\}\n\n sage: R = lie_conformal_algebras.Affine(QQ, 'A1'); latex(R.0.T(3))\n 6 T^{(3)}\\alpha_{1}\n "
if self.is_zero():
return '0'
p = self.parent()
try:
names = p.latex_variable_names()
except ValueError:
names = None
if names:
terms = [(('T^{{({0})}}{1}'.format(k1, names[p._index_to_pos[k0]]), v) if (k1 > 1) else (('T{}'.format(names[p._index_to_pos[k0]]), v) if (k1 == 1) else ('{}'.format(names[p._index_to_pos[k0]]), v))) for ((k0, k1), v) in self.monomial_coefficients().items()]
else:
terms = [(('T^{{({0})}}{1}'.format(k1, latex(k0)), v) if (k1 > 1) else (('T{}'.format(latex(k0)), v) if (k1 == 1) else ('{}'.format(latex(k0)), v))) for ((k0, k1), v) in self.monomial_coefficients().items()]
return repr_lincomb(terms, is_latex=True, strip_one=True)
|
class LieConformalAlgebraWithBasis(CombinatorialFreeModule):
"\n Abstract base class for a Lie conformal algebra with a\n preferred basis.\n\n This class provides no functionality, it simply passes the\n arguments to :class:`CombinatorialFreeModule`.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Virasoro(QQbar);R\n The Virasoro Lie conformal algebra over Algebraic Field\n\n TESTS::\n\n sage: R = lie_conformal_algebras.Virasoro(QQ)\n sage: R.0\n L\n sage: R._repr_generator(R.0)\n 'L'\n sage: R = lie_conformal_algebras.Affine(QQ, 'A1')\n sage: R.0\n B[alpha[1]]\n sage: R._repr_generator(R.0)\n 'B[alpha[1]]'\n sage: R = lie_conformal_algebras.Affine(QQ, 'A1', names = ('e', 'h','f'))\n sage: R.0\n e\n sage: R._repr_generator(R.0)\n 'e'\n "
def __init__(self, R, basis_keys=None, element_class=None, category=None, prefix=None, **kwds):
"\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Affine(QQ,'A1')\n sage: TestSuite(V).run()\n "
if (prefix is None):
prefix = ''
kwds['bracket'] = ''
kwds['string_quotes'] = False
default_category = LieConformalAlgebras(R).WithBasis()
try:
category = default_category.or_subcategory(category)
except ValueError:
category = default_category.Super().or_subcategory(category)
super().__init__(R, basis_keys=basis_keys, element_class=element_class, category=category, prefix=prefix, names=None, **kwds)
|
class LieConformalAlgebraWithStructureCoefficients(FinitelyFreelyGeneratedLCA):
"\n A Lie conformal algebra with a set of specified structure\n coefficients.\n\n INPUT:\n\n - ``R`` -- a ring (Default: ``None``); The base ring of this Lie\n conformal algebra. Behaviour is undefined if it is not a field\n of characteristic zero.\n\n - ``s_coeff`` -- Dictionary (Default: ``None``);\n a dictionary containing the `\\lambda` brackets of the\n generators of this Lie conformal algebra. The family encodes a\n dictionary whose keys\n are pairs of either names or indices of the generators\n and the values are themselves dictionaries. For a pair of\n generators `a` and `b`, the value of ``s_coeff[('a','b')]`` is\n a dictionary whose keys are positive integer numbers and the\n corresponding value for the key `j` is a dictionary itself\n representing the j-th product `a_{(j)}b`.\n Thus, for a positive integer number `j`, the value of\n ``s_coeff[('a','b')][j]`` is a dictionary whose entries are\n pairs ``('c',n)`` where ``'c'`` is the name of a generator\n and `n` is a positive number. The value for this key is the\n coefficient of `\\frac{T^{n}}{n!} c` in `a_{(j)}b`. For example\n the ``s_coeff`` for the *Virasoro* Lie conformal algebra is::\n\n {('L','L'):{0:{('L',1):1}, 1:{('L',0):2}, 3:{('C',0):1/2}}}\n\n\n Do not include central elements in this dictionary. Also, if\n the key ``('a','b')`` is present, there is no need to include\n ``('b','a')`` as it is defined by skew-symmetry.\n Any missing pair (besides the ones\n defined by skew-symmetry) is assumed to have vanishing\n `\\lambda`-bracket.\n\n - ``names`` -- tuple of ``str`` (Default: ``None``); The list of\n names for generators of this Lie conformal algebra. Do not\n include central elements in this list.\n\n - ``central_elements`` -- tuple of ``str`` (Default: ``None``);\n A list of names for central\n elements of this Lie conformal algebra.\n\n - ``index_set`` -- enumerated set (Default: ``None``);\n an indexing set for the generators of this Lie\n conformal algebra. Do not include central elements in this\n list.\n\n - ``parity`` -- tuple of `0` or `1` (Default: tuple of `0`);\n a tuple specifying the parity of each non-central generator.\n\n EXAMPLES:\n\n - We construct the `\\beta-\\gamma` system by directly giving the\n `\\lambda`-brackets of the generators::\n\n sage: betagamma_dict = {('b','a'):{0:{('K',0):1}}}\n sage: V = LieConformalAlgebra(QQ, betagamma_dict, names=('a','b'), weights=(1,0), central_elements=('K',))\n sage: V.category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Rational Field\n sage: V.inject_variables()\n Defining a, b, K\n sage: a.bracket(b)\n {0: -K}\n\n - We construct the centerless Virasoro Lie conformal algebra::\n\n sage: virdict = {('L','L'):{0:{('L',1):1}, 1:{('L',0): 2}}}\n sage: R = LieConformalAlgebra(QQbar, virdict, names='L')\n sage: R.inject_variables()\n Defining L\n sage: L.bracket(L)\n {0: TL, 1: 2*L}\n\n - The construction checks that skew-symmetry is violated::\n\n sage: wrongdict = {('L','L'):{0:{('L',1):2}, 1:{('L',0): 2}}}\n sage: LieConformalAlgebra(QQbar, wrongdict, names='L')\n Traceback (most recent call last):\n ...\n ValueError: two distinct values given for one and the same bracket. Skew-symmetry is not satisfied?\n "
@staticmethod
def _standardize_s_coeff(s_coeff, index_set, ce, parity=None):
"\n Convert an input dictionary to structure constants of this\n Lie conformal algebra.\n\n INPUT:\n\n - ``s_coeff`` -- a dictionary as in\n :class:`~sage.algebras.lie_conformal_algebras.lie_conformal_algebra_with_structure_coefficients.LieConformalAlgebraWithStructureCoefficients`.\n - ``index_set`` -- a finite enumerated set indexing the\n generators (not counting the central elements).\n - ``ce`` -- a tuple of ``str``; a list of names for the central\n generators of this Lie conformal algebra\n - ``parity`` -- a tuple of `0` or `1` (Default: tuple of `0`);\n this tuple specifies the parity of each non-central generator.\n\n OUTPUT:\n\n A finite Family representing ``s_coeff`` in the input.\n It contains superfluous information that can be obtained by\n skew-symmetry but that improves speed in computing OPE for\n vertex algebras.\n\n EXAMPLES::\n\n sage: virdict = {('L','L'):{0:{('L',1):1}, 1:{('L',0): 2},3:{('C', 0):1/2}}}\n sage: Vir = lie_conformal_algebras.Virasoro(QQ)\n sage: Vir._standardize_s_coeff(virdict, Family(('L',)), ('C',))\n Finite family {('L', 'L'): ((0, ((('L', 1), 1),)), (1, ((('L', 0), 2),)), (3, ((('C', 0), 1/2),)))}\n "
if (parity is None):
parity = ((0,) * index_set.cardinality())
index_to_parity = dict(zip(index_set, parity))
sc = {}
for mypair in s_coeff.keys():
v = s_coeff[mypair]
key = tuple(mypair)
vals = {}
for l in v:
lth_product = {k: y for (k, y) in v[l].items() if y}
if lth_product:
vals[l] = lth_product
myvals = tuple(((k, tuple(v.items())) for (k, v) in vals.items() if v))
if ((key in sc) and (sorted(sc[key]) != sorted(myvals))):
raise ValueError('two distinct values given for one and the same bracket, skew-symmetryis not satisfied?')
if myvals:
sc[key] = myvals
key = (mypair[1], mypair[0])
if (index_to_parity[mypair[0]] * index_to_parity[mypair[1]]):
parsgn = (- 1)
else:
parsgn = 1
maxpole = max(v)
vals = {}
for k in range((maxpole + 1)):
kth_product = {}
for j in range(((maxpole + 1) - k)):
if ((k + j) in v.keys()):
for i in v[(k + j)]:
if ((i[0] not in ce) or ((i[0] in ce) and ((i[1] + j) == 0))):
kth_product[(i[0], (i[1] + j))] = kth_product.get((i[0], (i[1] + j)), 0)
kth_product[(i[0], (i[1] + j))] += (((parsgn * v[(k + j)][i]) * ((- 1) ** ((k + j) + 1))) * binomial((i[1] + j), j))
kth_product = {k: v for (k, v) in kth_product.items() if v}
if kth_product:
vals[k] = kth_product
myvals = tuple(((k, tuple(v.items())) for (k, v) in vals.items() if v))
if ((key in sc) and (sorted(sc[key]) != sorted(myvals))):
raise ValueError('two distinct values given for one and the same bracket. Skew-symmetry is not satisfied?')
if myvals:
sc[key] = myvals
return Family(sc)
def __init__(self, R, s_coeff, index_set=None, central_elements=None, category=None, element_class=None, prefix=None, names=None, latex_names=None, parity=None, **kwds):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.NeveuSchwarz(QQ)\n sage: TestSuite(V).run()\n '
(names, index_set) = standardize_names_index_set(names, index_set)
if (central_elements is None):
central_elements = ()
if ((names is not None) and (names != tuple(index_set))):
names2 = (names + tuple(central_elements))
index_set2 = DisjointUnionEnumeratedSets((index_set, Family(tuple(central_elements))))
d = {x: index_set2[i] for (i, x) in enumerate(names2)}
try:
s_coeff = {(d[k[0]], d[k[1]]): {a: {(d[x[1]], x[2]): s_coeff[k][a][x] for x in s_coeff[k][a]} for a in s_coeff[k]} for k in s_coeff.keys()}
except KeyError:
pass
issuper = kwds.pop('super', False)
if (parity is None):
parity = ((0,) * index_set.cardinality())
else:
issuper = True
try:
assert (len(parity) == index_set.cardinality())
except AssertionError:
raise ValueError(f'parity should have the same length as the number of generators, got {parity}')
s_coeff = LieConformalAlgebraWithStructureCoefficients._standardize_s_coeff(s_coeff, index_set, central_elements, parity)
if ((names is not None) and (central_elements is not None)):
names += tuple(central_elements)
self._index_to_pos = {k: i for (i, k) in enumerate(index_set)}
if (central_elements is not None):
for (i, ce) in enumerate(central_elements):
self._index_to_pos[ce] = (len(index_set) + i)
default_category = LieConformalAlgebras(R).WithBasis().FinitelyGenerated()
if issuper:
category = default_category.Super().or_subcategory(category)
else:
category = default_category.or_subcategory(category)
if (element_class is None):
element_class = LCAStructureCoefficientsElement
FinitelyFreelyGeneratedLCA.__init__(self, R, index_set=index_set, central_elements=central_elements, category=category, element_class=element_class, prefix=prefix, names=names, latex_names=latex_names, **kwds)
s_coeff = dict(s_coeff)
self._s_coeff = Family({k: tuple(((j, sum(((c * self.monomial(i)) for (i, c) in v))) for (j, v) in s_coeff[k])) for k in s_coeff})
self._parity = dict(zip(self.gens(), (parity + ((0,) * len(central_elements)))))
def structure_coefficients(self):
"\n The structure coefficients of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(AA)\n sage: Vir.structure_coefficients()\n Finite family {('L', 'L'): ((0, TL), (1, 2*L), (3, 1/2*C))}\n\n sage: lie_conformal_algebras.NeveuSchwarz(QQ).structure_coefficients()\n Finite family {('G', 'G'): ((0, 2*L), (2, 2/3*C)), ('G', 'L'): ((0, 1/2*TG), (1, 3/2*G)), ('L', 'G'): ((0, TG), (1, 3/2*G)), ('L', 'L'): ((0, TL), (1, 2*L), (3, 1/2*C))}\n "
return self._s_coeff
def _repr_generator(self, x):
"\n String representation of the generator ``x``.\n\n INPUT:\n\n - ``x`` -- an index parametrizing a generator or a generator of\n this Lie conformal algebra\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQbar)\n sage: Vir._repr_generator(Vir.0)\n 'L'\n sage: R = lie_conformal_algebras.Affine(QQ, 'A1')\n sage: R._repr_generator(R.0)\n 'B[alpha[1]]'\n sage: R = lie_conformal_algebras.Affine(QQ, 'A1', names=('e','h','f'))\n sage: R._repr_generator(R.0)\n 'e'\n "
if (x in self):
return repr(x)
return IndexedGenerators._repr_generator(self, x)
|
class N2LieConformalAlgebra(GradedLieConformalAlgebra):
"\n The N=2 super Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring; the base ring of this super\n Lie conformal algebra.\n\n EXAMPLES::\n\n sage: x = polygen(ZZ, 'x')\n sage: F.<x> = NumberField(x^2 - 2)\n sage: R = lie_conformal_algebras.N2(F); R\n The N=2 super Lie conformal algebra over Number Field in x with defining polynomial x^2 - 2\n sage: R.inject_variables()\n Defining L, J, G1, G2, C\n sage: G1.bracket(G2)\n {0: L + 1/2*TJ, 1: J, 2: 1/3*C}\n sage: G2.bracket(G1)\n {0: L - 1/2*TJ, 1: -J, 2: 1/3*C}\n sage: G1.degree()\n 3/2\n sage: J.degree()\n 1\n\n The topological twist is a Virasoro vector with central\n charge 0::\n\n sage: L2 = L - 1/2*J.T()\n sage: L2.bracket(L2) == {0: L2.T(), 1: 2*L2}\n True\n\n The sum of the fermions is a generator of the Neveu-Schwarz\n Lie conformal algebra::\n\n sage: G = (G1 + G2)\n sage: G.bracket(G)\n {0: 2*L, 2: 2/3*C}\n "
def __init__(self, R):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.N2(QQ)\n sage: TestSuite(V).run()\n '
n2dict = {('L', 'L'): {0: {('L', 1): 1}, 1: {('L', 0): 2}, 3: {('C', 0): R(2).inverse_of_unit()}}, ('L', 'G1'): {0: {('G1', 1): 1}, 1: {('G1', 0): (3 * R(2).inverse_of_unit())}}, ('L', 'G2'): {0: {('G2', 1): 1}, 1: {('G2', 0): (3 * R(2).inverse_of_unit())}}, ('G1', 'G2'): {0: {('L', 0): 1, ('J', 1): R(2).inverse_of_unit()}, 1: {('J', 0): 1}, 2: {('C', 0): R(3).inverse_of_unit()}}, ('L', 'J'): {0: {('J', 1): 1}, 1: {('J', 0): 1}}, ('J', 'J'): {1: {('C', 0): R(3).inverse_of_unit()}}, ('J', 'G1'): {0: {('G1', 0): 1}}, ('J', 'G2'): {0: {('G2', 0): (- 1)}}}
from sage.rings.rational_field import QQ
weights = (2, 1, (QQ(3) / 2), (QQ(3) / 2))
parity = (0, 0, 1, 1)
GradedLieConformalAlgebra.__init__(self, R, n2dict, names=('L', 'J', 'G1', 'G2'), central_elements=('C',), weights=weights, parity=parity)
def _repr_(self):
'\n The name of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.N2(QQbar); R\n The N=2 super Lie conformal algebra over Algebraic Field\n '
return f'The N=2 super Lie conformal algebra over {self.base_ring()}'
|
class NeveuSchwarzLieConformalAlgebra(GradedLieConformalAlgebra):
"\n The Neveu-Schwarz super Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative Ring; the base ring of this Lie\n conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.NeveuSchwarz(AA); R\n The Neveu-Schwarz super Lie conformal algebra over Algebraic Real Field\n sage: R.structure_coefficients()\n Finite family {('G', 'G'): ((0, 2*L), (2, 2/3*C)), ('G', 'L'): ((0, 1/2*TG), (1, 3/2*G)), ('L', 'G'): ((0, TG), (1, 3/2*G)), ('L', 'L'): ((0, TL), (1, 2*L), (3, 1/2*C))}\n sage: R.inject_variables()\n Defining L, G, C\n sage: G.nproduct(G,0)\n 2*L\n sage: G.degree()\n 3/2\n "
def __init__(self, R):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.NeveuSchwarz(QQ)\n sage: TestSuite(V).run()\n '
nsdict = {('L', 'L'): {0: {('L', 1): 1}, 1: {('L', 0): 2}, 3: {('C', 0): R(2).inverse_of_unit()}}, ('L', 'G'): {0: {('G', 1): 1}, 1: {('G', 0): (R(3) * R(2).inverse_of_unit())}}, ('G', 'G'): {0: {('L', 0): 2}, 2: {('C', 0): (R(2) * R(3).inverse_of_unit())}}}
from sage.rings.rational_field import QQ
weights = (2, QQ((3, 2)))
parity = (0, 1)
GradedLieConformalAlgebra.__init__(self, R, nsdict, names=('L', 'G'), central_elements=('C',), weights=weights, parity=parity)
def _repr_(self):
'\n The name of this Lie Conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.NeveuSchwarz(GF(5)); R\n The Neveu-Schwarz super Lie conformal algebra over Finite Field of size 5\n '
return 'The Neveu-Schwarz super Lie conformal algebra over {}'.format(self.base_ring())
|
class VirasoroLieConformalAlgebra(GradedLieConformalAlgebra):
'\n The Virasoro Lie Conformal algebra over `R`.\n\n INPUT:\n\n - ``R`` -- a commutative ring; behaviour is undefined if `R` is\n not a Field of characteristic zero.\n\n EXAMPLES::\n\n sage: Vir = lie_conformal_algebras.Virasoro(QQ)\n sage: Vir.category()\n Category of H-graded finitely generated Lie conformal algebras with basis over Rational Field\n sage: Vir.inject_variables()\n Defining L, C\n sage: L.bracket(L)\n {0: TL, 1: 2*L, 3: 1/2*C}\n\n TESTS::\n\n sage: Vir.gens()\n (L, C)\n '
def __init__(self, R):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Virasoro(QQ)\n sage: TestSuite(V).run()\n '
virdict = {('L', 'L'): {0: {('L', 1): 1}, 1: {('L', 0): 2}, 3: {('C', 0): R(2).inverse_of_unit()}}}
GradedLieConformalAlgebra.__init__(self, R, virdict, names=('L',), central_elements=('C',), weights=(2,))
def _repr_(self):
'\n The name of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.Virasoro(QQbar)\n The Virasoro Lie conformal algebra over Algebraic Field\n '
return 'The Virasoro Lie conformal algebra over {}'.format(self.base_ring())
|
class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients):
"\n The Weyl Lie conformal algebra.\n\n INPUT:\n\n - ``R`` -- a commutative ring; the base ring of this Lie\n conformal algebra.\n - ``ngens``: an even positive Integer (default `2`); The number\n of non-central generators of this Lie conformal algebra.\n - ``gram_matrix``: a matrix (default: ``None``); A non-singular\n skew-symmetric square matrix with coefficients in `R`.\n - ``names`` -- a list or tuple of ``str``; alternative names\n for the generators\n - ``index_set`` -- an enumerated set; alternative indexing set\n for the generators\n\n\n OUTPUT:\n\n The Weyl Lie conformal algebra with generators\n `\\alpha_i`, `i=1,...,ngens` and `\\lambda`-brackets\n\n .. MATH::\n\n [{\\alpha_i}_{\\lambda} \\alpha_j] = M_{ij} K,\n\n where `M` is the ``gram_matrix`` above.\n\n .. NOTE::\n\n The returned Lie conformal algebra is not `H`-graded. For\n a related `H`-graded Lie conformal algebra see\n :class:`BosonicGhostsLieConformalAlgebra<sage.algebras.\\\n lie_conformal_algebras.bosonic_ghosts_lie_conformal_algebra\\\n .BosonicGhostsLieConformalAlgebra>`.\n\n EXAMPLES::\n\n sage: lie_conformal_algebras.Weyl(QQ)\n The Weyl Lie conformal algebra with generators (alpha0, alpha1, K) over Rational Field\n sage: R = lie_conformal_algebras.Weyl(QQbar, gram_matrix=Matrix(QQ,[[0,1],[-1,0]]), names = ('a','b'))\n sage: R.inject_variables()\n Defining a, b, K\n sage: a.bracket(b)\n {0: K}\n sage: b.bracket(a)\n {0: -K}\n\n sage: R = lie_conformal_algebras.Weyl(QQbar, ngens=4)\n sage: R.gram_matrix()\n [ 0 0| 1 0]\n [ 0 0| 0 1]\n [-----+-----]\n [-1 0| 0 0]\n [ 0 -1| 0 0]\n sage: R.inject_variables()\n Defining alpha0, alpha1, alpha2, alpha3, K\n sage: alpha0.bracket(alpha2)\n {0: K}\n\n sage: R = lie_conformal_algebras.Weyl(QQ); R.category()\n Category of finitely generated Lie conformal algebras with basis over Rational Field\n sage: R in LieConformalAlgebras(QQ).Graded()\n False\n sage: R.inject_variables()\n Defining alpha0, alpha1, K\n sage: alpha0.degree()\n Traceback (most recent call last):\n ...\n AttributeError: 'WeylLieConformalAlgebra_with_category.element_class' object has no attribute 'degree'...\n\n TESTS::\n\n sage: lie_conformal_algebras.Weyl(ZZ, gram_matrix=identity_matrix(ZZ,3))\n Traceback (most recent call last):\n ...\n ValueError: The gram_matrix should be a non degenerate skew-symmetric 3 x 3 matrix, got [1 0 0]\n [0 1 0]\n [0 0 1]\n "
def __init__(self, R, ngens=None, gram_matrix=None, names=None, index_set=None):
'\n Initialize self.\n\n TESTS::\n\n sage: V = lie_conformal_algebras.Weyl(QQ)\n sage: TestSuite(V).run()\n '
from sage.matrix.matrix_space import MatrixSpace
if ngens:
from sage.rings.integer_ring import ZZ
if (not ((ngens in ZZ) and (not (ngens % 2)))):
raise ValueError(f'ngens needs to be an even positive Integer, got {ngens}')
if (gram_matrix is not None):
if (ngens is None):
ngens = gram_matrix.dimensions()[0]
try:
assert (gram_matrix in MatrixSpace(R, ngens, ngens))
except AssertionError:
raise ValueError('The gram_matrix should be a skew-symmetric {0} x {0} matrix, got {1}'.format(ngens, gram_matrix))
if ((not gram_matrix.is_skew_symmetric()) or gram_matrix.is_singular()):
raise ValueError('The gram_matrix should be a non degenerate skew-symmetric {0} x {0} matrix, got {1}'.format(ngens, gram_matrix))
elif (gram_matrix is None):
if (ngens is None):
ngens = 2
A = identity_matrix(R, (ngens // 2))
from sage.matrix.special import block_matrix
gram_matrix = block_matrix([[R.zero(), A], [(- A), R.zero()]])
latex_names = None
if ((names is None) and (index_set is None)):
names = 'alpha'
latex_names = (tuple((('\\alpha_{%d}' % i) for i in range(ngens))) + ('K',))
(names, index_set) = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens)
weyldict = {(i, j): {0: {('K', 0): gram_matrix[(index_set.rank(i), index_set.rank(j))]}} for i in index_set for j in index_set}
super().__init__(R, weyldict, names=names, latex_names=latex_names, index_set=index_set, central_elements=('K',))
self._gram_matrix = gram_matrix
def _repr_(self):
'\n The name of this Lie conformal algebra.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Weyl(ZZ); R\n The Weyl Lie conformal algebra with generators (alpha0, alpha1, K) over Integer Ring\n '
return 'The Weyl Lie conformal algebra with generators {} over {}'.format(self.gens(), self.base_ring())
def gram_matrix(self):
'\n The Gram matrix that specifies the `\\lambda`-brackets of the\n generators.\n\n EXAMPLES::\n\n sage: R = lie_conformal_algebras.Weyl(QQbar, ngens=4)\n sage: R.gram_matrix()\n [ 0 0| 1 0]\n [ 0 0| 0 1]\n [-----+-----]\n [-1 0| 0 0]\n [ 0 -1| 0 0]\n '
return self._gram_matrix
|
class NilCoxeterAlgebra(IwahoriHeckeAlgebra.T):
'\n Construct the Nil-Coxeter algebra of given type.\n\n This is the algebra\n with generators `u_i` for every node `i` of the corresponding Dynkin\n diagram. It has the usual braid relations (from the Weyl group) as well\n as the quadratic relation `u_i^2 = 0`.\n\n INPUT:\n\n - ``W`` -- a Weyl group\n\n OPTIONAL ARGUMENTS:\n\n - ``base_ring`` -- a ring (default is the rational numbers)\n - ``prefix`` -- a label for the generators (default "u")\n\n EXAMPLES::\n\n sage: U = NilCoxeterAlgebra(WeylGroup([\'A\',3,1]))\n sage: u0, u1, u2, u3 = U.algebra_generators()\n sage: u1*u1\n 0\n sage: u2*u1*u2 == u1*u2*u1\n True\n sage: U.an_element()\n u[0,1,2,3] + 2*u[0] + 3*u[1] + 1\n '
def __init__(self, W, base_ring=QQ, prefix='u'):
"\n Initiate the affine nil-Coxeter algebra corresponding to the Weyl\n group `W` over the base ring.\n\n EXAMPLES::\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['A',3,1])); U\n The Nil-Coxeter Algebra of Type A3~ over Rational Field\n sage: TestSuite(U).run()\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['C',3]), ZZ); U\n The Nil-Coxeter Algebra of Type C3 over Integer Ring\n sage: TestSuite(U).run()\n "
self._W = W
self._n = W.n
self._base_ring = base_ring
self._cartan_type = W.cartan_type()
H = IwahoriHeckeAlgebra(W, 0, 0, base_ring=base_ring)
super(IwahoriHeckeAlgebra.T, self).__init__(H, prefix=prefix)
def _repr_(self):
"\n EXAMPLES::\n\n sage: NilCoxeterAlgebra(WeylGroup(['A',3,1])) # indirect doctest\n The Nil-Coxeter Algebra of Type A3~ over Rational Field\n "
return ('The Nil-Coxeter Algebra of Type %s over %s' % (self._cartan_type._repr_(compact=True), self.base_ring()))
def homogeneous_generator_noncommutative_variables(self, r):
"\n Give the `r^{th}` homogeneous function inside the Nil-Coxeter algebra.\n In finite type `A` this is the sum of all decreasing elements of length `r`.\n In affine type `A` this is the sum of all cyclically decreasing elements of length `r`.\n This is only defined in finite type `A`, `B` and affine types `A^{(1)}`, `B^{(1)}`, `C^{(1)}`, `D^{(1)}`.\n\n INPUT:\n\n - ``r`` -- a positive integer at most the rank of the Weyl group\n\n EXAMPLES::\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['A',3,1]))\n sage: U.homogeneous_generator_noncommutative_variables(2)\n u[1,0] + u[2,0] + u[0,3] + u[3,2] + u[3,1] + u[2,1]\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['B',4]))\n sage: U.homogeneous_generator_noncommutative_variables(2)\n u[1,2] + u[2,1] + u[3,1] + u[4,1] + u[2,3] + u[3,2] + u[4,2] + u[3,4] + u[4,3]\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['C',3]))\n sage: U.homogeneous_generator_noncommutative_variables(2)\n Traceback (most recent call last):\n ...\n AssertionError: Analogue of symmetric functions in noncommutative variables is not defined in type ['C', 3]\n\n TESTS::\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['B',3,1]))\n sage: U.homogeneous_generator_noncommutative_variables(-1)\n 0\n sage: U.homogeneous_generator_noncommutative_variables(0)\n 1\n "
ct = self._cartan_type
msg = f'Analogue of symmetric functions in noncommutative variables is not defined in type {ct}'
assert (((len(ct) == 2) and (ct[0] in ['A', 'B'])) or ((len(ct) == 3) and (ct[2] == 1))), msg
if (r >= self._n):
return self.zero()
return self.sum_of_monomials((w for w in self._W.pieri_factors() if (w.length() == r)))
def homogeneous_noncommutative_variables(self, la):
"\n Give the homogeneous function indexed by `la`, viewed inside the Nil-Coxeter algebra.\n\n This is only defined in finite type `A`, `B` and affine types `A^{(1)}`, `B^{(1)}`, `C^{(1)}`, `D^{(1)}`.\n\n INPUT:\n\n - ``la`` -- a partition with first part bounded by the rank of the Weyl group\n\n EXAMPLES::\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['B',2,1]))\n sage: U.homogeneous_noncommutative_variables([2,1])\n u[1,2,0] + 2*u[2,1,0] + u[0,2,0] + u[0,2,1] + u[1,2,1] + u[2,1,2] + u[2,0,2] + u[1,0,2]\n\n TESTS::\n\n sage: U = NilCoxeterAlgebra(WeylGroup(['B',2,1]))\n sage: U.homogeneous_noncommutative_variables([])\n 1\n\n "
return prod((self.homogeneous_generator_noncommutative_variables(p) for p in la))
def k_schur_noncommutative_variables(self, la):
"\n In type `A^{(1)}` this is the `k`-Schur function in noncommutative variables\n defined by Thomas Lam [Lam2005]_.\n\n This function is currently only defined in type `A^{(1)}`.\n\n INPUT:\n\n - ``la`` -- a partition with first part bounded by the rank of the Weyl group\n\n EXAMPLES::\n\n sage: A = NilCoxeterAlgebra(WeylGroup(['A',3,1]))\n sage: A.k_schur_noncommutative_variables([2,2])\n u[0,3,1,0] + u[3,1,2,0] + u[1,2,0,1] + u[3,2,0,3] + u[2,0,3,1] + u[2,3,1,2]\n\n TESTS::\n\n sage: A = NilCoxeterAlgebra(WeylGroup(['A',3,1]))\n sage: A.k_schur_noncommutative_variables([])\n 1\n\n sage: A.k_schur_noncommutative_variables([1,2])\n Traceback (most recent call last):\n ...\n AssertionError: [1, 2] is not a partition.\n\n sage: A.k_schur_noncommutative_variables([4,2])\n Traceback (most recent call last):\n ...\n AssertionError: [4, 2] is not a 3-bounded partition.\n\n sage: C = NilCoxeterAlgebra(WeylGroup(['C',3,1]))\n sage: C.k_schur_noncommutative_variables([2,2])\n Traceback (most recent call last):\n ...\n AssertionError: Weyl Group of type ['C', 3, 1] (as a matrix group acting on the root space) is not affine type A.\n\n\n "
assert ((self._cartan_type[0] == 'A') and (len(self._cartan_type) == 3) and (self._cartan_type[2] == 1)), ('%s is not affine type A.' % self._W)
assert (la in Partitions()), ('%s is not a partition.' % la)
assert ((len(la) == 0) or (la[0] < self._W.n)), ('%s is not a %s-bounded partition.' % (la, (self._W.n - 1)))
Sym = SymmetricFunctions(self._base_ring)
h = Sym.homogeneous()
ks = Sym.kschur((self._n - 1), 1)
f = h(ks[la])
return sum(((f.coefficient(x) * self.homogeneous_noncommutative_variables(x)) for x in f.support()))
|
class OrlikSolomonAlgebra(CombinatorialFreeModule):
'\n An Orlik-Solomon algebra.\n\n Let `R` be a commutative ring. Let `M` be a matroid with ground set\n `X`. Let `C(M)` denote the set of circuits of `M`. Let `E` denote\n the exterior algebra over `R` generated by `\\{ e_x \\mid x \\in X \\}`.\n The *Orlik-Solomon ideal* `J(M)` is the ideal of `E` generated by\n\n .. MATH::\n\n \\partial e_S := \\sum_{i=1}^t (-1)^{i-1} e_{j_1} \\wedge e_{j_2}\n \\wedge \\cdots \\wedge \\widehat{e}_{j_i} \\wedge \\cdots \\wedge e_{j_t}\n\n for all `S = \\left\\{ j_1 < j_2 < \\cdots < j_t \\right\\} \\in C(M)`,\n where `\\widehat{e}_{j_i}` means that the term `e_{j_i}` is being\n omitted. The notation `\\partial e_S` is not a coincidence, as\n `\\partial e_S` is actually the image of\n `e_S := e_{j_1} \\wedge e_{j_2} \\wedge \\cdots \\wedge e_{j_t}` under the\n unique derivation `\\partial` of `E` which sends all `e_x` to `1`.\n\n It is easy to see that `\\partial e_S \\in J(M)` not only for circuits\n `S`, but also for any dependent set `S` of `M`. Moreover, every\n dependent set `S` of `M` satisfies `e_S \\in J(M)`.\n\n The *Orlik-Solomon algebra* `A(M)` is the quotient `E / J(M)`. This is\n a graded finite-dimensional skew-commutative `R`-algebra. Fix\n some ordering on `X`; then, the NBC sets of `M` (that is, the subsets\n of `X` containing no broken circuit of `M`) form a basis of `A(M)`.\n (Here, a *broken circuit* of `M` is defined to be the result of\n removing the smallest element from a circuit of `M`.)\n\n In the current implementation, the basis of `A(M)` is indexed by the\n NBC sets, which are implemented as frozensets.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``M`` -- the defining matroid\n - ``ordering`` -- (optional) an ordering of the ground set\n\n EXAMPLES:\n\n We create the Orlik-Solomon algebra of the uniform matroid `U(3, 4)`\n and do some basic computations::\n\n sage: M = matroids.Uniform(3, 4)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.dimension()\n 14\n sage: G = OS.algebra_generators()\n sage: M.broken_circuits()\n frozenset({frozenset({1, 2, 3})})\n sage: G[1] * G[2] * G[3]\n OS{0, 1, 2} - OS{0, 1, 3} + OS{0, 2, 3}\n\n REFERENCES:\n\n - :wikipedia:`Arrangement_of_hyperplanes#The_Orlik-Solomon_algebra`\n\n - [CE2001]_\n '
@staticmethod
def __classcall_private__(cls, R, M, ordering=None):
'\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: from sage.algebras.orlik_solomon import OrlikSolomonAlgebra\n sage: OS1 = OrlikSolomonAlgebra(QQ, M)\n sage: OS2 = OrlikSolomonAlgebra(QQ, M, ordering=(0,1,2,3,4,5))\n sage: OS3 = OrlikSolomonAlgebra(QQ, M, ordering=[0,1,2,3,4,5])\n sage: OS1 is OS2 and OS2 is OS3\n True\n '
if (ordering is None):
ordering = sorted(M.groundset())
return super().__classcall__(cls, R, M, tuple(ordering))
def __init__(self, R, M, ordering=None):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: TestSuite(OS).run()\n\n We check on the matroid associated to the graph with 3 vertices and\n 2 edges between each vertex::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True)\n sage: MG = Matroid(G)\n sage: OS = MG.orlik_solomon_algebra(QQ)\n sage: elts = OS.some_elements() + list(OS.algebra_generators())\n sage: TestSuite(OS).run(elements=elts)\n '
self._M = M
self._sorting = {x: i for (i, x) in enumerate(ordering)}
self._broken_circuits = {}
for c in self._M.circuits():
L = sorted(c, key=(lambda x: self._sorting[x]))
self._broken_circuits[frozenset(L[1:])] = L[0]
cat = Algebras(R).FiniteDimensional().WithBasis().Graded()
CombinatorialFreeModule.__init__(self, R, M.no_broken_circuits_sets(ordering), prefix='OS', bracket='{', sorting_key=self._sort_key, category=cat)
def _sort_key(self, x):
'\n Return the key used to sort the terms.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS._sort_key(frozenset({1, 2}))\n (-2, [1, 2])\n sage: OS._sort_key(frozenset({0, 1, 2}))\n (-3, [0, 1, 2])\n sage: OS._sort_key(frozenset({}))\n (0, [])\n '
return ((- len(x)), sorted(x))
def _repr_term(self, m):
"\n Return a string representation of the basis element indexed by `m`.\n\n EXAMPLES::\n\n sage: M = matroids.Uniform(3, 4)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS._repr_term(frozenset([0]))\n 'OS{0}'\n "
return 'OS{{{}}}'.format(', '.join((str(t) for t in sorted(m))))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: M.orlik_solomon_algebra(QQ)\n Orlik-Solomon algebra of Wheel(3): Regular matroid of rank 3\n on 6 elements with 16 bases\n '
return 'Orlik-Solomon algebra of {}'.format(self._M)
@cached_method
def one_basis(self):
'\n Return the index of the basis element corresponding to `1`\n in ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.one_basis() == frozenset([])\n True\n '
return frozenset({})
@cached_method
def algebra_generators(self):
'\n Return the algebra generators of ``self``.\n\n These form a family indexed by the ground set `X` of `M`. For\n each `x \\in X`, the `x`-th element is `e_x`.\n\n EXAMPLES::\n\n sage: M = matroids.Uniform(2, 2)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.algebra_generators()\n Finite family {0: OS{0}, 1: OS{1}}\n\n sage: M = matroids.Uniform(1, 2)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.algebra_generators()\n Finite family {0: OS{0}, 1: OS{0}}\n\n sage: M = matroids.Uniform(1, 3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.algebra_generators()\n Finite family {0: OS{0}, 1: OS{0}, 2: OS{0}}\n '
return Family(sorted(self._M.groundset()), (lambda i: self.subset_image(frozenset([i]))))
@cached_method
def product_on_basis(self, a, b):
'\n Return the product in ``self`` of the basis elements\n indexed by ``a`` and ``b``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.product_on_basis(frozenset([2]), frozenset([3,4]))\n OS{0, 1, 2} - OS{0, 1, 4} + OS{0, 2, 3} + OS{0, 3, 4}\n\n ::\n\n sage: G = OS.algebra_generators()\n sage: prod(G)\n 0\n sage: G[2] * G[4]\n -OS{1, 2} + OS{1, 4}\n sage: G[3] * G[4] * G[2]\n OS{0, 1, 2} - OS{0, 1, 4} + OS{0, 2, 3} + OS{0, 3, 4}\n sage: G[2] * G[3] * G[4]\n OS{0, 1, 2} - OS{0, 1, 4} + OS{0, 2, 3} + OS{0, 3, 4}\n sage: G[3] * G[2] * G[4]\n -OS{0, 1, 2} + OS{0, 1, 4} - OS{0, 2, 3} - OS{0, 3, 4}\n\n TESTS:\n\n Let us check that `e_{s_1} e_{s_2} \\cdots e_{s_k} = e_S` for any\n subset `S = \\{ s_1 < s_2 < \\cdots < s_k \\}` of the ground set::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True)\n sage: MG = Matroid(G).regular_matroid()\n sage: E = MG.groundset_list()\n sage: OS = MG.orlik_solomon_algebra(ZZ)\n sage: G = OS.algebra_generators()\n sage: import itertools\n sage: def test_prod(F):\n ....: LHS = OS.subset_image(frozenset(F))\n ....: RHS = OS.prod([G[i] for i in sorted(F)])\n ....: return LHS == RHS\n sage: all( test_prod(F) for k in range(len(E)+1)\n ....: for F in itertools.combinations(E, k) )\n True\n '
if (not a):
return self.basis()[b]
if (not b):
return self.basis()[a]
if (not a.isdisjoint(b)):
return self.zero()
R = self.base_ring()
if (len(a) == 1):
i = list(a)[0]
ns = b.union({i})
ns_sorted = sorted(ns, key=(lambda x: self._sorting[x]))
coeff = ((- 1) ** ns_sorted.index(i))
return (R(coeff) * self.subset_image(ns))
if ((len(a) % 4) < 2):
sign = R.one()
else:
sign = (- R.one())
r = self._from_dict({b: sign}, remove_zeros=False)
G = self.algebra_generators()
for i in sorted(a, key=(lambda x: self._sorting[x])):
r = (G[i] * r)
return r
@cached_method
def subset_image(self, S):
'\n Return the element `e_S` of `A(M)` (``== self``) corresponding to\n a subset `S` of the ground set of `M`.\n\n INPUT:\n\n - ``S`` -- a frozenset which is a subset of the ground set of `M`\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: BC = sorted(M.broken_circuits(), key=sorted)\n sage: for bc in BC: (sorted(bc), OS.subset_image(bc))\n ([1, 3], -OS{0, 1} + OS{0, 3})\n ([1, 4, 5], OS{0, 1, 4} - OS{0, 1, 5} - OS{0, 3, 4} + OS{0, 3, 5})\n ([2, 3, 4], OS{0, 1, 2} - OS{0, 1, 4} + OS{0, 2, 3} + OS{0, 3, 4})\n ([2, 3, 5], OS{0, 2, 3} + OS{0, 3, 5})\n ([2, 4], -OS{1, 2} + OS{1, 4})\n ([2, 5], -OS{0, 2} + OS{0, 5})\n ([4, 5], -OS{3, 4} + OS{3, 5})\n\n sage: # needs sage.graphs\n sage: M4 = matroids.CompleteGraphic(4)\n sage: OSM4 = M4.orlik_solomon_algebra(QQ)\n sage: OSM4.subset_image(frozenset({2,3,4}))\n OS{0, 2, 3} + OS{0, 3, 4}\n\n An example of a custom ordering::\n\n sage: # needs sage.graphs\n sage: G = Graph([[3, 4], [4, 1], [1, 2], [2, 3], [3, 5], [5, 6], [6, 3]])\n sage: MG = Matroid(G)\n sage: s = [(5, 6), (1, 2), (3, 5), (2, 3), (1, 4), (3, 6), (3, 4)]\n sage: sorted([sorted(c) for c in MG.circuits()])\n [[(1, 2), (1, 4), (2, 3), (3, 4)],\n [(3, 5), (3, 6), (5, 6)]]\n sage: OSMG = MG.orlik_solomon_algebra(QQ, ordering=s)\n sage: OSMG.subset_image(frozenset([]))\n OS{}\n sage: OSMG.subset_image(frozenset([(1,2),(3,4),(1,4),(2,3)]))\n 0\n sage: OSMG.subset_image(frozenset([(2,3),(1,2),(3,4)]))\n OS{(1, 2), (2, 3), (3, 4)}\n sage: OSMG.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(5,6)]))\n -OS{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)}\n + OS{(1, 2), (1, 4), (3, 4), (3, 6), (5, 6)}\n - OS{(1, 2), (2, 3), (3, 4), (3, 6), (5, 6)}\n sage: OSMG.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(3,5)]))\n OS{(1, 2), (1, 4), (2, 3), (3, 5), (5, 6)}\n - OS{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)}\n + OS{(1, 2), (1, 4), (3, 4), (3, 5), (5, 6)}\n + OS{(1, 2), (1, 4), (3, 4), (3, 6), (5, 6)}\n - OS{(1, 2), (2, 3), (3, 4), (3, 5), (5, 6)}\n - OS{(1, 2), (2, 3), (3, 4), (3, 6), (5, 6)}\n\n TESTS::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True)\n sage: MG = Matroid(G)\n sage: sorted([sorted(c) for c in MG.circuits()])\n [[0, 1], [0, 2, 4], [0, 2, 5], [0, 3, 4],\n [0, 3, 5], [1, 2, 4], [1, 2, 5], [1, 3, 4],\n [1, 3, 5], [2, 3], [4, 5]]\n sage: OSMG = MG.orlik_solomon_algebra(QQ)\n sage: OSMG.subset_image(frozenset([]))\n OS{}\n sage: OSMG.subset_image(frozenset([1, 2, 3]))\n 0\n sage: OSMG.subset_image(frozenset([1, 3, 5]))\n 0\n sage: OSMG.subset_image(frozenset([1, 2]))\n OS{0, 2}\n sage: OSMG.subset_image(frozenset([3, 4]))\n -OS{0, 2} + OS{0, 4}\n sage: OSMG.subset_image(frozenset([1, 5]))\n OS{0, 4}\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True)\n sage: MG = Matroid(G)\n sage: sorted([sorted(c) for c in MG.circuits()])\n [[0, 1], [2, 3, 4]]\n sage: OSMG = MG.orlik_solomon_algebra(QQ)\n sage: OSMG.subset_image(frozenset([]))\n OS{}\n sage: OSMG.subset_image(frozenset([1, 3, 4]))\n -OS{0, 2, 3} + OS{0, 2, 4}\n\n We check on a non-standard ordering::\n\n sage: M = matroids.Wheel(3)\n sage: o = [5,4,3,2,1,0]\n sage: OS = M.orlik_solomon_algebra(QQ, ordering=o)\n sage: BC = sorted(M.broken_circuits(ordering=o), key=sorted)\n sage: for bc in BC: (sorted(bc), OS.subset_image(bc))\n ([0, 1], OS{0, 3} - OS{1, 3})\n ([0, 1, 4], OS{0, 3, 5} - OS{0, 4, 5} - OS{1, 3, 5} + OS{1, 4, 5})\n ([0, 2], OS{0, 5} - OS{2, 5})\n ([0, 2, 3], -OS{0, 3, 5} + OS{2, 3, 5})\n ([1, 2], OS{1, 4} - OS{2, 4})\n ([1, 2, 3], -OS{1, 3, 5} + OS{1, 4, 5} + OS{2, 3, 5} - OS{2, 4, 5})\n ([3, 4], OS{3, 5} - OS{4, 5})\n '
if (not isinstance(S, frozenset)):
raise ValueError('S needs to be a frozenset')
for bc in self._broken_circuits:
if bc.issubset(S):
i = self._broken_circuits[bc]
if (i in S):
return self.zero()
coeff = self.base_ring().one()
r = self.zero()
switch = False
Si = S.union({i})
Ss = sorted(Si, key=(lambda x: self._sorting[x]))
for j in Ss:
if (j in bc):
r += (coeff * self.subset_image(Si.difference({j})))
if switch:
coeff *= (- 1)
if (j == i):
switch = True
return r
return self.monomial(S)
def degree_on_basis(self, m):
'\n Return the degree of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OS = M.orlik_solomon_algebra(QQ)\n sage: OS.degree_on_basis(frozenset([1]))\n 1\n sage: OS.degree_on_basis(frozenset([0, 2, 3]))\n 3\n '
return len(m)
def as_gca(self):
"\n Return the graded commutative algebra corresponding to ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.geometry.polyhedron sage.graphs\n sage: H = hyperplane_arrangements.braid(3)\n sage: O = H.orlik_solomon_algebra(QQ)\n sage: O.as_gca()\n Graded Commutative Algebra with generators ('e0', 'e1', 'e2') in degrees (1, 1, 1)\n with relations [e0*e1 - e0*e2 + e1*e2] over Rational Field\n\n ::\n\n sage: N = matroids.named_matroids.Fano()\n sage: O = N.orlik_solomon_algebra(QQ)\n sage: O.as_gca() # needs sage.libs.singular\n Graded Commutative Algebra with generators ('e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6')\n in degrees (1, 1, 1, 1, 1, 1, 1) with relations\n [e1*e2 - e1*e3 + e2*e3, e0*e1*e3 - e0*e1*e4 + e0*e3*e4 - e1*e3*e4,\n e0*e2 - e0*e4 + e2*e4, e3*e4 - e3*e5 + e4*e5,\n e1*e2*e4 - e1*e2*e5 + e1*e4*e5 - e2*e4*e5,\n e0*e2*e3 - e0*e2*e5 + e0*e3*e5 - e2*e3*e5, e0*e1 - e0*e5 + e1*e5,\n e2*e5 - e2*e6 + e5*e6, e1*e3*e5 - e1*e3*e6 + e1*e5*e6 - e3*e5*e6,\n e0*e4*e5 - e0*e4*e6 + e0*e5*e6 - e4*e5*e6, e1*e4 - e1*e6 + e4*e6,\n e2*e3*e4 - e2*e3*e6 + e2*e4*e6 - e3*e4*e6, e0*e3 - e0*e6 + e3*e6,\n e0*e1*e2 - e0*e1*e6 + e0*e2*e6 - e1*e2*e6] over Rational Field\n\n TESTS::\n\n sage: # needs sage.geometry.polyhedron\n sage: H = hyperplane_arrangements.Catalan(3,QQ).cone()\n sage: O = H.orlik_solomon_algebra(QQ)\n sage: A = O.as_gca()\n sage: H.poincare_polynomial()\n 20*x^3 + 29*x^2 + 10*x + 1\n sage: [len(A.basis(i)) for i in range(5)]\n [1, 10, 29, 20, 0]\n\n "
from sage.algebras.commutative_dga import GradedCommutativeAlgebra
gens = self.algebra_generators()
gkeys = gens.keys()
names = ['e{}'.format(i) for i in range(len(gens))]
A = GradedCommutativeAlgebra(self.base_ring(), names)
rels = []
for bc in self._broken_circuits.items():
bclist = ([bc[1]] + list(bc[0]))
indices = [gkeys.index(el) for el in bclist]
indices.sort()
rel = A.zero()
sign = (- ((- 1) ** len(indices)))
for i in indices:
mon = A.one()
for j in indices:
if (j != i):
mon *= A.gen(j)
rel += (sign * mon)
sign = (- sign)
rels.append(rel)
I = A.ideal(rels)
return A.quotient(I)
def as_cdga(self):
"\n Return the commutative differential graded algebra corresponding to ``self``\n with the trivial differential.\n\n EXAMPLES::\n\n sage: # needs sage.geometry.polyhedron sage.graphs\n sage: H = hyperplane_arrangements.braid(3)\n sage: O = H.orlik_solomon_algebra(QQ)\n sage: O.as_cdga()\n Commutative Differential Graded Algebra with generators ('e0', 'e1', 'e2')\n in degrees (1, 1, 1) with relations [e0*e1 - e0*e2 + e1*e2] over Rational Field\n with differential:\n e0 --> 0\n e1 --> 0\n e2 --> 0\n "
return self.as_gca().cdg_algebra({})
|
class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule):
"\n The invariant algebra of the Orlik-Solomon algebra from the\n action on `A(M)` induced from the ``action_on_groundset``.\n\n INPUT:\n\n - ``R`` -- the ring of coefficients\n - ``M`` -- a matroid\n - ``G`` -- a semigroup\n - ``action_on_groundset`` -- (optional) a function defining the action\n of ``G`` on the elements of the groundset of ``M``; default is ``g(x)``\n\n EXAMPLES:\n\n Lets start with the action of `S_3` on the rank `2` braid matroid::\n\n sage: # needs sage.graphs\n sage: M = matroids.CompleteGraphic(3)\n sage: M.groundset()\n frozenset({0, 1, 2})\n sage: G = SymmetricGroup(3) # needs sage.groups\n\n Calling elements ``g`` of ``G`` on an element `i` of `\\{1, 2, 3\\}`\n defines the action we want, but since the groundset is `\\{0, 1, 2\\}`\n we first add `1` and then subtract `1`::\n\n sage: def on_groundset(g, x):\n ....: return g(x+1) - 1\n\n Now that we have defined an action we can create the invariant, and\n get its basis::\n\n sage: # needs sage.graphs sage.groups\n sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, on_groundset))\n sage: OSG.basis()\n Finite family {0: B[0], 1: B[1]}\n sage: [OSG.lift(b) for b in OSG.basis()]\n [OS{}, OS{0} + OS{1} + OS{2}]\n\n Since it is invariant, the action of any ``g`` in ``G`` is trivial::\n\n sage: # needs sage.graphs sage.groups\n sage: x = OSG.an_element(); x\n 2*B[0] + 2*B[1]\n sage: g = G.an_element(); g\n (2,3)\n sage: g * x\n 2*B[0] + 2*B[1]\n\n sage: # needs sage.graphs sage.groups\n sage: x = OSG.random_element()\n sage: g = G.random_element()\n sage: g * x == x\n True\n\n The underlying ambient module is the Orlik-Solomon algebra,\n which is accessible via :meth:`ambient()`::\n\n sage: M.orlik_solomon_algebra(QQ) is OSG.ambient() # needs sage.graphs sage.groups\n True\n\n There is not much structure here, so lets look at a bigger example.\n Here we will look at the rank `3` braid matroid, and to make things\n easier, we'll start the indexing at `1` so that the `S_6` action\n on the groundset is simply calling `g`::\n\n sage: # needs sage.graphs sage.groups\n sage: M = matroids.CompleteGraphic(4); M.groundset()\n frozenset({0, 1, 2, 3, 4, 5})\n sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()]\n sage: M = Matroid(bases=new_bases); M.groundset()\n frozenset({1, 2, 3, 4, 5, 6})\n sage: G = SymmetricGroup(6)\n sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G)\n sage: OSG.basis()\n Finite family {0: B[0], 1: B[1]}\n sage: [OSG.lift(b) for b in OSG.basis()]\n [OS{}, OS{1} + OS{2} + OS{3} + OS{4} + OS{5} + OS{6}]\n sage: (OSG.basis()[1])^2\n 0\n sage: 5 * OSG.basis()[1]\n 5*B[1]\n\n Next, we look at the same matroid but with an `S_3 \\times S_3` action\n (here realized as a Young subgroup of `S_6`)::\n\n sage: # needs sage.graphs sage.groups\n sage: H = G.young_subgroup([3, 3])\n sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H)\n sage: OSH.basis()\n Finite family {0: B[0], 1: B[1], 2: B[2]}\n sage: [OSH.lift(b) for b in OSH.basis()]\n [OS{}, OS{4} + OS{5} + OS{6}, OS{1} + OS{2} + OS{3}]\n\n We implement an `S_4` action on the vertices::\n\n sage: # needs sage.graphs sage.groups\n sage: M = matroids.CompleteGraphic(4)\n sage: G = SymmetricGroup(4)\n sage: edge_map = {i: M.groundset_to_edges([i])[0][:2]\n ....: for i in M.groundset()}\n sage: inv_map = {v: k for k, v in edge_map.items()}\n sage: def vert_action(g, x):\n ....: a, b = edge_map[x]\n ....: return inv_map[tuple(sorted([g(a+1)-1, g(b+1)-1]))]\n sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action))\n sage: B = OSG.basis()\n sage: [OSG.lift(b) for b in B]\n [OS{}, OS{0} + OS{1} + OS{2} + OS{3} + OS{4} + OS{5}]\n\n We use this to describe the Young subgroup `S_2 \\times S_2` action::\n\n sage: # needs sage.graphs sage.groups\n sage: H = G.young_subgroup([2,2])\n sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action))\n sage: B = OSH.basis()\n sage: [OSH.lift(b) for b in B]\n [OS{}, OS{5}, OS{1} + OS{2} + OS{3} + OS{4}, OS{0},\n -1/2*OS{1, 2} + OS{1, 5} - 1/2*OS{3, 4} + OS{3, 5},\n OS{0, 5}, OS{0, 1} + OS{0, 2} + OS{0, 3} + OS{0, 4},\n -1/2*OS{0, 1, 2} + OS{0, 1, 5} - 1/2*OS{0, 3, 4} + OS{0, 3, 5}]\n\n We demonstrate the algebra structure::\n\n sage: matrix([[b*bp for b in B] for bp in B]) # needs sage.graphs sage.groups\n [ B[0] B[1] B[2] B[3] B[4] B[5] B[6] B[7]]\n [ B[1] 0 2*B[4] B[5] 0 0 2*B[7] 0]\n [ B[2] -2*B[4] 0 B[6] 0 -2*B[7] 0 0]\n [ B[3] -B[5] -B[6] 0 B[7] 0 0 0]\n [ B[4] 0 0 B[7] 0 0 0 0]\n [ B[5] 0 -2*B[7] 0 0 0 0 0]\n [ B[6] 2*B[7] 0 0 0 0 0 0]\n [ B[7] 0 0 0 0 0 0 0]\n\n .. NOTE::\n\n The algebra structure only exists when the action on the\n groundset yields an equivariant matroid, in the sense that\n `g \\cdot I \\in \\mathcal{I}` for every `g \\in G` and for\n every `I \\in \\mathcal{I}`.\n "
def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs sage.groups\n sage: M = matroids.CompleteGraphic(4)\n sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()]\n sage: M = Matroid(bases=new_bases)\n sage: G = SymmetricGroup(6)\n sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G)\n sage: TestSuite(OSG).run()\n '
ordering = kwargs.pop('ordering', None)
OS = OrlikSolomonAlgebra(R, M, ordering)
self._ambient = OS
if (action_on_groundset is None):
def action_on_groundset(g, x):
return g(x)
self._groundset_action = action_on_groundset
self._side = kwargs.pop('side', 'left')
category = kwargs.pop('category', OS.category().Subobjects())
def action(g, m):
return OS.sum(((c * self._basis_action(g, x)) for (x, c) in m._monomial_coefficients.items()))
self._action = action
max_deg = max([b.degree() for b in OS.basis()])
B = []
for d in range((max_deg + 1)):
OS_d = OS.homogeneous_component(d)
OSG_d = OS_d.invariant_module(G, action=action, category=category)
B += [OS_d.lift(OSG_d.lift(b)) for b in OSG_d.basis()]
from sage.modules.with_basis.subquotient import SubmoduleWithBasis
SubmoduleWithBasis.__init__(self, Family(B), *args, support_order=OS._compute_support_order(B), ambient=OS, unitriangular=False, category=category, **kwargs)
self._semigroup = G
def construction(self):
'\n Return the functorial construction of ``self``.\n\n This implementation of the method only returns ``None``.\n\n TESTS::\n\n sage: M = matroids.Wheel(3)\n sage: from sage.algebras.orlik_solomon import OrlikSolomonAlgebra\n sage: OS1 = OrlikSolomonAlgebra(QQ, M)\n sage: OS1.construction() is None\n True\n '
return None
def _basis_action(self, g, f):
'\n Return the action of the group element ``g`` on the n.b.c. set ``f``\n in the ambient Orlik-Solomon algebra.\n\n INPUT:\n\n - ``g`` -- a group element\n - ``f`` -- ``frozenset`` for an n.b.c. set\n\n OUTPUT:\n\n - the result of the action of ``g`` on ``f`` inside\n of the Orlik-Solomon algebra\n\n EXAMPLES::\n\n sage: # needs sage.graphs sage.groups\n sage: M = matroids.CompleteGraphic(3)\n sage: M.groundset()\n frozenset({0, 1, 2})\n sage: G = SymmetricGroup(3)\n sage: def on_groundset(g, x):\n ....: return g(x+1)-1\n sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset))\n sage: act = lambda g: (OSG._basis_action(g,frozenset({0,1})),\n ....: OSG._basis_action(g,frozenset({0,2})))\n sage: [act(g) for g in G]\n [(OS{0, 1}, OS{0, 2}),\n (-OS{0, 2}, OS{0, 1} - OS{0, 2}),\n (-OS{0, 1} + OS{0, 2}, -OS{0, 1}),\n (OS{0, 2}, OS{0, 1}),\n (OS{0, 1} - OS{0, 2}, -OS{0, 2}),\n (-OS{0, 1}, -OS{0, 1} + OS{0, 2})]\n\n We also check that the ordering is respected::\n\n sage: # needs sage.graphs sage.groups\n sage: fset = frozenset({1,2})\n sage: OS1 = M.orlik_solomon_algebra(QQ)\n sage: OS1.subset_image(fset)\n -OS{0, 1} + OS{0, 2}\n sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1))\n sage: OS2.subset_image(fset)\n OS{1, 2}\n sage: OSG2 = M.orlik_solomon_algebra(QQ,\n ....: invariant=(G,on_groundset),\n ....: ordering=range(2,-1,-1))\n sage: g = G.an_element(); g\n (2,3)\n\n This choice of ``g`` acting on this choice of ``fset`` reverses\n the sign::\n\n sage: OSG._basis_action(g, fset) # needs sage.graphs sage.groups\n OS{0, 1} - OS{0, 2}\n sage: OSG2._basis_action(g, fset) # needs sage.graphs sage.groups\n -OS{1, 2}\n '
OS = self._ambient
if (not f):
return OS.one()
basis_elt = sorted(f, key=OS._sorting.__getitem__)
gx = OS.one()
for e in basis_elt:
fset = frozenset([self._groundset_action(g, e)])
gx = (gx * OS.subset_image(fset))
return gx
|
class OrlikTeraoAlgebra(CombinatorialFreeModule):
"\n An Orlik-Terao algebra.\n\n Let `R` be a commutative ring. Let `M` be a matroid with ground set\n `X` with some fixed ordering and representation `A = (a_x)_{x \\in X}`\n (so `a_x` is a (column) vector). Let `C(M)` denote the set of circuits\n of `M`. Let `P` denote the quotient algebra `R[e_x \\mid x \\in X] /\n \\langle e_x^2 \\rangle`, i.e., the polynomial algebra with squares being\n zero. The *Orlik-Terao ideal* `J(M)` is the ideal of `P` generated by\n\n .. MATH::\n\n \\partial e_S := \\sum_{i=1}^t (-1)^i \\chi(S \\setminus \\{j_i\\})\n e_{S \\setminus \\{j_i\\}}\n\n for all `S = \\left\\{ j_1 < j_2 < \\cdots < j_t \\right\\} \\in C(M)`,\n where `\\chi(T)` is defined as follows. If `T` is linearly dependent,\n then `\\chi(T) = 0`. Otherwise, let `T = \\{x_1 < \\cdots < x_{|T|}\\}`,\n and for every flat `F` of `M`, choose a basis `\\Theta_F`.\n Then define `\\chi(T) = \\det(b_1, \\dotsc, b_{|T|})`, where `b_i` is\n `a_{x_i}` expressed in the basis `\\Theta_F`.\n\n It is easy to see that `\\partial e_S \\in J(M)` not only for circuits\n `S`, but also for any dependent set `S` of `M`. Moreover, every\n dependent set `S` of `M` satisfies `e_S \\in J(M)`.\n\n The *Orlik-Terao algebra* `A(M)` is the quotient `E / J(M)`.\n This is a graded finite-dimensional commutative `R`-algebra.\n The non-broken circuit (NBC) sets of `M` (that is, the subsets\n of `X` containing :meth:`no broken circuit\n <sage.matroids.matroid.Matroid.no_broken_circuits_sets>`\n of `M`) form a basis of `A(M)`. (Recall that a\n :meth:`broken circuit <sage.matroids.matroid.Matroid.broken_circuit>`\n of `M` is defined to be the result of removing\n the smallest element from a circuit of `M`.)\n\n In the current implementation, the basis of `A(M)` is indexed by the\n NBC sets, which are implemented as frozensets.\n\n INPUT:\n\n - ``R`` -- the base ring\n - ``M`` -- the defining matroid\n - ``ordering`` -- (optional) an ordering of the ground set\n\n EXAMPLES:\n\n We create the Orlik-Terao algebra of the wheel matroid `W(3)`\n and do some basic computations::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT.dimension()\n 24\n sage: G = OT.algebra_generators()\n sage: sorted(map(sorted, M.broken_circuits()))\n [[1, 3], [1, 4, 5], [2, 3, 4], [2, 3, 5], [2, 4], [2, 5], [4, 5]]\n sage: G[1] * G[2] * G[3]\n OT{0, 1, 2} + OT{0, 2, 3}\n sage: G[1] * G[4] * G[5]\n -OT{0, 1, 4} - OT{0, 1, 5} - OT{0, 3, 4} - OT{0, 3, 5}\n\n We create an example of a linear matroid and do a basic computation::\n\n sage: R = ZZ['t'].fraction_field()\n sage: t = R.gen()\n sage: mat = matrix(R, [[1-3*t/(t+2), t, 5], [-2, 1, 3/(7-t)]])\n sage: M = Matroid(mat)\n sage: OT = M.orlik_terao_algebra()\n sage: G = OT.algebra_generators()\n sage: G[1] * G[2]\n ((2*t^3-12*t^2-12*t-14)/(8*t^2-19*t-70))*OT{0, 1}\n + ((10*t^2-44*t-146)/(-8*t^2+19*t+70))*OT{0, 2}\n\n REFERENCES:\n\n - [OT1994]_\n - [FL2001]_\n - [CF2005]_\n "
@staticmethod
def __classcall_private__(cls, R, M, ordering=None):
'\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: from sage.algebras.orlik_terao import OrlikTeraoAlgebra\n sage: OT1 = algebras.OrlikTerao(QQ, M)\n sage: OT2 = OrlikTeraoAlgebra(QQ, M, ordering=(0,1,2,3,4,5))\n sage: OT3 = OrlikTeraoAlgebra(QQ, M, ordering=[0,1,2,3,4,5])\n sage: OT1 is OT2 and OT2 is OT3\n True\n '
if (ordering is None):
ordering = sorted(M.groundset())
return super().__classcall__(cls, R, M, tuple(ordering))
def __init__(self, R, M, ordering=None):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: TestSuite(OT).run(elements=OT.basis())\n\n sage: # needs sage.graphs\n sage: M = matroids.CompleteGraphic(4).ternary_matroid()\n sage: OT = M.orlik_terao_algebra(GF(3)['t'])\n sage: TestSuite(OT).run(elements=OT.basis())\n\n sage: # needs sage.geometry.polyhedron\n sage: H = hyperplane_arrangements.Catalan(4).cone()\n sage: M = H.matroid()\n sage: OT = M.orlik_terao_algebra()\n sage: OT.dimension()\n 672\n sage: TestSuite(OT).run(elements=list(OT.basis()))\n\n We check on the matroid associated to the graph with 3 vertices and\n 2 edges between each vertex::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True)\n sage: M = Matroid(G).regular_matroid()\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: elts = OT.some_elements() + list(OT.basis())\n sage: TestSuite(OT).run(elements=elts)\n "
self._M = M
self._sorting = {x: i for (i, x) in enumerate(ordering)}
self._broken_circuits = {}
for c in self._M.circuits():
L = sorted(c, key=self._sorting.__getitem__)
self._broken_circuits[frozenset(L[1:])] = L[0]
cat = Algebras(R).FiniteDimensional().Commutative().WithBasis().Graded()
CombinatorialFreeModule.__init__(self, R, M.no_broken_circuits_sets(ordering), prefix='OT', bracket='{', sorting_key=self._sort_key, category=cat)
def _sort_key(self, x):
'\n Return the key used to sort the terms.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT._sort_key(frozenset({1, 2}))\n (-2, [1, 2])\n sage: OT._sort_key(frozenset({0, 1, 2}))\n (-3, [0, 1, 2])\n sage: OT._sort_key(frozenset({}))\n (0, [])\n '
return ((- len(x)), sorted(x))
def _repr_term(self, m):
"\n Return a string representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT._repr_term(frozenset([0]))\n 'OT{0}'\n "
return 'OT{{{}}}'.format(', '.join((str(t) for t in sorted(m))))
def _latex_term(self, m):
"\n Return a string representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT._latex_term(frozenset([0, 1]))\n 'e_{\\\\left\\\\{0, 1\\\\right\\\\}}'\n sage: OT._latex_term(frozenset())\n 'e_{\\\\emptyset}'\n "
if (not m):
return 'e_{\\emptyset}'
from sage.misc.latex import latex
from sage.sets.set import Set
return 'e_{{{}}}'.format(latex(Set(sorted(m))))
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: M.orlik_terao_algebra(QQ)\n Orlik-Terao algebra of Wheel(3): Regular matroid of rank 3\n on 6 elements with 16 bases over Rational Field\n '
return 'Orlik-Terao algebra of {} over {}'.format(self._M, self.base_ring())
@cached_method
def one_basis(self):
'\n Return the index of the basis element corresponding to `1`\n in ``self``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT.one_basis() == frozenset([])\n True\n '
return frozenset({})
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n These form a family indexed by the ground set `X` of `M`. For\n each `x \\in X`, the `x`-th element is `e_x`.\n\n EXAMPLES::\n\n sage: M = matroids.Whirl(2)\n sage: OT = M.orlik_terao_algebra()\n sage: OT.algebra_generators()\n Finite family {0: OT{0}, 1: OT{1}, 2: OT{2}, 3: OT{3}}\n\n sage: M = matroids.named_matroids.Fano()\n sage: OT = M.orlik_terao_algebra()\n sage: OT.algebra_generators()\n Finite family {'a': OT{a}, 'b': OT{b}, 'c': OT{c}, 'd': OT{d},\n 'e': OT{e}, 'f': OT{f}, 'g': OT{g}}\n\n sage: M = matroids.named_matroids.NonFano()\n sage: OT = M.orlik_terao_algebra(GF(3)['t'])\n sage: OT.algebra_generators()\n Finite family {'a': OT{a}, 'b': OT{b}, 'c': OT{c}, 'd': OT{d},\n 'e': OT{e}, 'f': OT{f}, 'g': OT{g}}\n "
return Family(sorted(self._M.groundset()), (lambda i: self.subset_image(frozenset([i]))))
def degree_on_basis(self, m):
'\n Return the degree of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT.degree_on_basis(frozenset([1]))\n 1\n sage: OT.degree_on_basis(frozenset([0, 2, 3]))\n 3\n '
return len(m)
def product_on_basis(self, a, b):
'\n Return the product in ``self`` of the basis elements\n indexed by ``a`` and ``b``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT.product_on_basis(frozenset([2]), frozenset([3,4]))\n OT{0, 1, 2} + OT{0, 1, 4} + OT{0, 2, 3} + OT{0, 3, 4}\n\n ::\n\n sage: G = OT.algebra_generators()\n sage: prod(G)\n 0\n sage: G[2] * G[4]\n OT{1, 2} + OT{1, 4}\n sage: G[3] * G[4] * G[2]\n OT{0, 1, 2} + OT{0, 1, 4} + OT{0, 2, 3} + OT{0, 3, 4}\n sage: G[2] * G[3] * G[4]\n OT{0, 1, 2} + OT{0, 1, 4} + OT{0, 2, 3} + OT{0, 3, 4}\n sage: G[3] * G[2] * G[4]\n OT{0, 1, 2} + OT{0, 1, 4} + OT{0, 2, 3} + OT{0, 3, 4}\n\n TESTS:\n\n Let us check that `e_{s_1} e_{s_2} \\cdots e_{s_k} = e_S` for any\n subset `S = \\{ s_1 < s_2 < \\cdots < s_k \\}` of the ground set::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True)\n sage: M = Matroid(G).regular_matroid()\n sage: E = M.groundset_list()\n sage: OT = M.orlik_terao_algebra(ZZ)\n sage: G = OT.algebra_generators()\n sage: import itertools\n sage: def test_prod(F):\n ....: LHS = OT.subset_image(frozenset(F))\n ....: RHS = OT.prod([G[i] for i in sorted(F)])\n ....: return LHS == RHS\n sage: all( test_prod(F) for k in range(len(E)+1)\n ....: for F in itertools.combinations(E, k) )\n True\n '
if (not a):
return self.basis()[b]
if (not b):
return self.basis()[a]
if (not a.isdisjoint(b)):
return self.zero()
return self.subset_image(b.union(a))
@cached_method
def subset_image(self, S):
'\n Return the element `e_S` of ``self`` corresponding to a\n subset ``S`` of the ground set of the defining matroid.\n\n INPUT:\n\n - ``S`` -- a frozenset which is a subset of the ground set of `M`\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra()\n sage: BC = sorted(M.broken_circuits(), key=sorted)\n sage: for bc in BC: (sorted(bc), OT.subset_image(bc))\n ([1, 3], OT{0, 1} + OT{0, 3})\n ([1, 4, 5], -OT{0, 1, 4} - OT{0, 1, 5} - OT{0, 3, 4} - OT{0, 3, 5})\n ([2, 3, 4], OT{0, 1, 2} + OT{0, 1, 4} + OT{0, 2, 3} + OT{0, 3, 4})\n ([2, 3, 5], -OT{0, 2, 3} + OT{0, 3, 5})\n ([2, 4], OT{1, 2} + OT{1, 4})\n ([2, 5], -OT{0, 2} + OT{0, 5})\n ([4, 5], -OT{3, 4} - OT{3, 5})\n\n sage: # needs sage.graphs\n sage: M4 = matroids.CompleteGraphic(4).ternary_matroid()\n sage: OT = M4.orlik_terao_algebra()\n sage: OT.subset_image(frozenset({2,3,4}))\n OT{0, 2, 3} + 2*OT{0, 3, 4}\n\n An example of a custom ordering::\n\n sage: # needs sage.graphs\n sage: G = Graph([[3, 4], [4, 1], [1, 2], [2, 3], [3, 5], [5, 6], [6, 3]])\n sage: M = Matroid(G).regular_matroid()\n sage: s = [(5, 6), (1, 2), (3, 5), (2, 3), (1, 4), (3, 6), (3, 4)]\n sage: sorted([sorted(c) for c in M.circuits()])\n [[(1, 2), (1, 4), (2, 3), (3, 4)],\n [(3, 5), (3, 6), (5, 6)]]\n sage: OT = M.orlik_terao_algebra(QQ, ordering=s)\n sage: OT.subset_image(frozenset([]))\n OT{}\n sage: OT.subset_image(frozenset([(1,2),(3,4),(1,4),(2,3)]))\n 0\n sage: OT.subset_image(frozenset([(2,3),(1,2),(3,4)]))\n OT{(1, 2), (2, 3), (3, 4)}\n sage: OT.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(5,6)]))\n -OT{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)}\n - OT{(1, 2), (1, 4), (3, 4), (3, 6), (5, 6)}\n + OT{(1, 2), (2, 3), (3, 4), (3, 6), (5, 6)}\n sage: OT.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(3,5)]))\n -OT{(1, 2), (1, 4), (2, 3), (3, 5), (5, 6)}\n + OT{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)}\n - OT{(1, 2), (1, 4), (3, 4), (3, 5), (5, 6)}\n + OT{(1, 2), (1, 4), (3, 4), (3, 6), (5, 6)}\n + OT{(1, 2), (2, 3), (3, 4), (3, 5), (5, 6)}\n - OT{(1, 2), (2, 3), (3, 4), (3, 6), (5, 6)}\n\n TESTS::\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True)\n sage: M = Matroid(G).regular_matroid()\n sage: sorted([sorted(c) for c in M.circuits()])\n [[0, 1], [0, 2, 4], [0, 2, 5], [0, 3, 4],\n [0, 3, 5], [1, 2, 4], [1, 2, 5], [1, 3, 4],\n [1, 3, 5], [2, 3], [4, 5]]\n sage: OT = M.orlik_terao_algebra()\n sage: OT.subset_image(frozenset([]))\n OT{}\n sage: OT.subset_image(frozenset([1, 2, 3]))\n 0\n sage: OT.subset_image(frozenset([1, 3, 5]))\n 0\n sage: OT.subset_image(frozenset([1, 2]))\n OT{0, 2}\n sage: OT.subset_image(frozenset([3, 4]))\n -OT{0, 2} + OT{0, 4}\n sage: OT.subset_image(frozenset([1, 5]))\n OT{0, 4}\n\n sage: # needs sage.graphs\n sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True)\n sage: M = Matroid(G).regular_matroid()\n sage: sorted([sorted(c) for c in M.circuits()])\n [[0, 1], [2, 3, 4]]\n sage: OT = M.orlik_terao_algebra(QQ)\n sage: OT.subset_image(frozenset([]))\n OT{}\n sage: OT.subset_image(frozenset([1, 3, 4]))\n -OT{0, 2, 3} + OT{0, 2, 4}\n\n We check on a non-standard ordering::\n\n sage: M = matroids.Wheel(3)\n sage: o = [5,4,3,2,1,0]\n sage: OT = M.orlik_terao_algebra(QQ, ordering=o)\n sage: BC = sorted(M.broken_circuits(ordering=o), key=sorted)\n sage: for bc in BC: (sorted(bc), OT.subset_image(bc))\n ([0, 1], -OT{0, 3} + OT{1, 3})\n ([0, 1, 4], OT{0, 3, 5} + OT{0, 4, 5} - OT{1, 3, 5} - OT{1, 4, 5})\n ([0, 2], OT{0, 5} - OT{2, 5})\n ([0, 2, 3], OT{0, 3, 5} - OT{2, 3, 5})\n ([1, 2], -OT{1, 4} + OT{2, 4})\n ([1, 2, 3], OT{1, 3, 5} + OT{1, 4, 5} - OT{2, 3, 5} - OT{2, 4, 5})\n ([3, 4], -OT{3, 5} - OT{4, 5})\n '
if (not isinstance(S, frozenset)):
raise ValueError('S needs to be a frozenset')
R = self.base_ring()
mone = (- R.one())
for bc in self._broken_circuits:
if bc.issubset(S):
i = self._broken_circuits[bc]
if (i in S):
return self.zero()
r = self.zero()
Si = S.union({i})
C = bc.union({i})
lc = self._chi(bc)
for (ind, j) in enumerate(sorted(bc, key=self._sorting.__getitem__)):
coeff = self._chi(C.difference({j}))
if coeff:
r += (((mone ** ind) * R((coeff / lc))) * self.subset_image(Si.difference({j})))
return r
return self.monomial(S)
@cached_method
def _flat_module(self, F):
'\n Return a vector space for the flat ``F``.\n\n EXAMPLES::\n\n sage: M = matroids.Wheel(3)\n sage: OT = M.orlik_terao_algebra()\n sage: OT._flat_module(list(M.flats(2))[0])\n Vector space of degree 3 and dimension 2 over Rational Field\n Basis matrix:\n [1 0 0]\n [0 1 0]\n '
rep_vecs = self._M.representation_vectors()
return matrix(self.base_ring().fraction_field(), [rep_vecs[x] for x in F]).row_module()
@cached_method
def _chi(self, X):
'\n Return `\\chi(X)` for an independent set ``X``.\n\n EXAMPLES::\n\n sage: # needs sage.geometry.polyhedron\n sage: H = hyperplane_arrangements.Catalan(2).cone()\n sage: M = H.matroid()\n sage: OT = M.orlik_terao_algebra()\n sage: [OT._chi(X) for X in sorted(M.independent_sets(), key=sorted)]\n [1, -1, -1, -1, -2, 1, -1, -1, 1, 1, 1]\n '
R = self.base_ring()
assert self._M.is_independent(X)
M = self._M
rep_vecs = M.representation_vectors()
V = self._flat_module(M.closure(X))
X = sorted(X, key=self._sorting.__getitem__)
return R(matrix([V.echelon_coordinates(rep_vecs[x]) for x in X]).det())
|
class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule):
'\n Give the invariant algebra of the Orlik-Terao algebra from the\n action on `A(M)` which is induced from the ``action_on_groundset``.\n\n INPUT:\n\n - ``R`` -- the ring of coefficients\n - ``M`` -- a matroid\n - ``G`` -- a semigroup\n - ``action_on_groundset`` -- a function defining the action of\n ``G`` on the elements of the groundset of ``M`` default\n\n OUTPUT:\n\n - The invariant algebra of the Orlik-Terao algebra induced by\n the action of ``action_on_groundset``\n\n EXAMPLES:\n\n Lets start with the action of `S_3` on the rank-`2` braid matroid::\n\n sage: A = matrix([[1,1,0],[-1,0,1],[0,-1,-1]])\n sage: M = Matroid(A)\n sage: M.groundset()\n frozenset({0, 1, 2})\n sage: G = SymmetricGroup(3) # needs sage.groups\n\n Calling elements ``g`` of ``G`` on an element `i` of `\\{1,2,3\\}`\n defines the action we want, but since the groundset is `\\{0,1,2\\}`\n we first add `1` and then subtract `1`::\n\n sage: def on_groundset(g,x):\n ....: return g(x+1)-1\n\n Now that we have defined an action we can create the invariant, and\n get its basis::\n\n sage: # needs sage.groups\n sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G, on_groundset))\n sage: OTG.basis()\n Finite family {0: B[0], 1: B[1]}\n sage: [OTG.lift(b) for b in OTG.basis()]\n [OT{}, OT{0} + OT{1} + OT{2}]\n\n Since it is invariant, the action of any ``g`` in ``G`` is trivial::\n\n sage: # needs sage.groups\n sage: x = OTG.an_element(); x\n 2*B[0] + 2*B[1]\n sage: g = G.an_element(); g\n (2,3)\n sage: g*x\n 2*B[0] + 2*B[1]\n\n sage: # needs sage.groups\n sage: x = OTG.random_element()\n sage: g = G.random_element()\n sage: g*x == x\n True\n\n The underlying ambient module is the Orlik-Terao algebra,\n which is accessible via :meth:`ambient()`::\n\n sage: M.orlik_terao_algebra(QQ) is OTG.ambient() # needs sage.groups\n True\n\n For a bigger example, here we will look at the rank-`3` braid matroid::\n\n sage: # needs sage.groups\n sage: A = matrix([[1,1,1,0,0,0],[-1,0,0,1,1,0],\n ....: [0,-1,0,-1,0,1],[0,0,-1,0,-1,-1]]); A\n [ 1 1 1 0 0 0]\n [-1 0 0 1 1 0]\n [ 0 -1 0 -1 0 1]\n [ 0 0 -1 0 -1 -1]\n sage: M = Matroid(A); M.groundset()\n frozenset({0, 1, 2, 3, 4, 5})\n sage: G = SymmetricGroup(6)\n sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G, on_groundset))\n sage: OTG.ambient()\n Orlik-Terao algebra of\n Linear matroid of rank 3 on 6 elements represented over the Rational Field\n over Rational Field\n sage: OTG.basis()\n Finite family {0: B[0], 1: B[1]}\n sage: [OTG.lift(b) for b in OTG.basis()]\n [OT{}, OT{0} + OT{1} + OT{2} + OT{3} + OT{4} + OT{5}]\n\n '
def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.groups\n sage: A = matrix([[1,1,1,0,0,0],[-1,0,0,1,1,0],[0,-1,0,-1,0,1],\n ....: [0,0,-1,0,-1,-1]])\n sage: M = Matroid(A);\n sage: G = SymmetricGroup(6)\n sage: def on_groundset(g,x): return g(x+1)-1\n sage: import __main__; __main__.on_groundset = on_groundset\n sage: OTG = M.orlik_terao_algebra(QQ, invariant = (G,on_groundset))\n sage: TestSuite(OTG).run()\n\n '
ordering = kwargs.pop('ordering', None)
OT = OrlikTeraoAlgebra(R, M, ordering)
self._ambient = OT
if (action_on_groundset is None):
def action_on_groundset(g, x):
return g(x)
self._groundset_action = action_on_groundset
self._side = kwargs.pop('side', 'left')
if ('category' in kwargs):
category = kwargs.pop('category')
else:
from sage.categories.modules import Modules
category = Modules(R).FiniteDimensional().WithBasis().Subobjects()
def action(g, m):
return OT.sum(((c * self._basis_action(g, x)) for (x, c) in m._monomial_coefficients.items()))
self._action = action
max_deg = max([b.degree() for b in OT.basis()])
B = []
for d in range((max_deg + 1)):
OT_d = OT.homogeneous_component(d)
OTG_d = OT_d.invariant_module(G, action=action, category=category)
B += [OT_d.lift(OTG_d.lift(b)) for b in OTG_d.basis()]
from sage.modules.with_basis.subquotient import SubmoduleWithBasis
SubmoduleWithBasis.__init__(self, Family(B), *args, support_order=OT._compute_support_order(B), ambient=OT, unitriangular=False, category=category, **kwargs)
self._semigroup = G
def construction(self):
'\n Return the functorial construction of ``self``.\n\n This implementation of the method only returns ``None``.\n\n TESTS::\n\n sage: # needs sage.groups\n sage: A = matrix([[1,1,0],[-1,0,1],[0,-1,-1]])\n sage: M = Matroid(A)\n sage: G = SymmetricGroup(3)\n sage: def on_groundset(g,x):\n ....: return g(x+1)-1\n sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G,on_groundset))\n sage: OTG.construction() is None\n True\n '
return None
def _basis_action(self, g, f):
'\n Let ``f`` be an n.b.c. set so that it indexes a basis\n element of the ambient Orlik-Terao algebra of ``M``.\n\n INPUT:\n\n - ``g`` -- a group element\n - ``f`` -- a ``frozenset`` representing an n.b.c. set\n\n OUTPUT:\n\n - ``x`` -- the result of the action of ``g`` on ``f`` inside\n of the Orlik-Terao algebra\n\n EXAMPLES::\n\n sage: # needs sage.groups\n sage: A = matrix([[1,1,0],[-1,0,1],[0,-1,-1]])\n sage: M = Matroid(A)\n sage: M.groundset()\n frozenset({0, 1, 2})\n sage: G = SymmetricGroup(3)\n sage: def on_groundset(g,x):\n ....: return g(x+1)-1\n sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G,on_groundset))\n sage: def act(g):\n ....: a = OTG._basis_action(g,frozenset({0,1}))\n ....: b = OTG._basis_action(g,frozenset({0,2}))\n ....: return a,b\n sage: [act(g) for g in G]\n [(OT{0, 1}, OT{0, 2}),\n (OT{0, 2}, -OT{0, 1} + OT{0, 2}),\n (-OT{0, 1} + OT{0, 2}, OT{0, 1}),\n (OT{0, 2}, OT{0, 1}),\n (-OT{0, 1} + OT{0, 2}, OT{0, 2}),\n (OT{0, 1}, -OT{0, 1} + OT{0, 2})]\n\n We also check that the ordering is respected::\n\n sage: # needs sage.groups\n sage: fset = frozenset({1,2})\n sage: OT1 = M.orlik_terao_algebra(QQ)\n sage: OT1.subset_image(fset)\n -OT{0, 1} + OT{0, 2}\n sage: OT2 = M.orlik_terao_algebra(QQ,range(2,-1,-1))\n sage: OT2.subset_image(fset)\n OT{1, 2}\n\n sage: # needs sage.groups\n sage: OTG2 = M.orlik_terao_algebra(QQ,\n ....: invariant=(G,on_groundset),\n ....: ordering=range(2,-1,-1))\n sage: g = G.an_element(); g\n (2,3)\n\n This choice of ``g`` fixes these elements::\n\n sage: # needs sage.groups\n sage: OTG._basis_action(g, fset)\n -OT{0, 1} + OT{0, 2}\n sage: OTG2._basis_action(g, fset)\n OT{1, 2}\n\n TESTS::\n\n sage: # needs sage.groups\n sage: [on_groundset(g, e) for e in M.groundset()]\n [0, 2, 1]\n sage: [OTG._groundset_action(g,e) for e in M.groundset()]\n [0, 2, 1]\n sage: [OTG2._groundset_action(g,e) for e in M.groundset()]\n [0, 2, 1]\n '
OT = self._ambient
if (not f):
return OT(f)
fset = frozenset((self._groundset_action(g, e) for e in f))
return OT.subset_image(fset)
|
class qCommutingPolynomials_generic(CombinatorialFreeModule):
'\n Base class for algebra of `q`-commuting (Laurent, etc.) polynomials.\n\n Let `R` be a commutative ring, and fix an element `q \\in R`. Let\n `B = (B_{xy})_{x,y \\in I}` be a skew-symmetric bilinear form with\n index set `I`. Let `R[I]_{q,B}` denote the polynomial ring in the variables\n `I` such that we have the `q`-*commuting* relation for `x, y \\in I`:\n\n .. MATH::\n\n y x = q^{B_{xy}} \\cdot x y.\n\n This is a graded `R`-algebra with a natural basis given by monomials\n written in increasing order with respect to some total order on `I`.\n '
@staticmethod
def __classcall__(cls, q, n=None, B=None, base_ring=None, names=None):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R1.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R2 = algebras.qCommutingPolynomials(q, base_ring=q.parent(), names='x,y,z')\n sage: R3 = algebras.qCommutingPolynomials(q, names=['x', 'y', 'z'])\n sage: R1 is R2 is R3\n True\n "
if (base_ring is not None):
q = base_ring(q)
if ((B is None) and isinstance(n, Matrix)):
(n, B) = (B, n)
if (names is None):
raise ValueError('the names of the variables must be given')
from sage.structure.category_object import normalize_names
if (n is None):
if isinstance(names, str):
n = (names.count(',') + 1)
else:
n = len(names)
names = normalize_names(n, names)
n = len(names)
if (B is None):
B = matrix.zero(ZZ, n)
for i in range(n):
for j in range((i + 1), n):
B[(i, j)] = 1
B[(j, i)] = (- 1)
B.set_immutable()
else:
if (not B.is_skew_symmetric()):
raise ValueError('the matrix must be skew symmetric')
B = B.change_ring(ZZ)
B.set_immutable()
return super().__classcall__(cls, q=q, B=B, names=names)
def __init__(self, q, B, indices, names):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: TestSuite(R).run()\n "
self._q = q
self._B = B
base_ring = q.parent()
if (base_ring not in CommutativeRings()):
raise ValueError('the base ring must be a commutative ring')
category = Algebras(base_ring).WithBasis().Graded()
CombinatorialFreeModule.__init__(self, base_ring, indices, bracket=False, prefix='', sorting_key=qCommutingPolynomials_generic._term_key, names=names, category=category)
@staticmethod
def _term_key(x):
"\n Compute a key for ``x`` for comparisons.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: elt = (x*y^3*z^2).leading_support()\n sage: R._term_key(elt)\n (6, [2, 3, 1])\n "
L = x.list()
L.reverse()
return (sum(L), L)
def gen(self, i):
"\n Return the ``i``-generator of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.gen(0)\n x\n sage: R.gen(2)\n z\n "
return self.monomial(self._indices.gen(i))
@cached_method
def gens(self):
"\n Return the generators of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.gens()\n (x, y, z)\n "
return tuple([self.monomial(g) for g in self._indices.gens()])
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.algebra_generators()\n Finite family {'x': x, 'y': y, 'z': z}\n "
d = {v: self.gen(i) for (i, v) in enumerate(self.variable_names())}
return Family(self.variable_names(), d.__getitem__, name='generator')
def degree_on_basis(self, m):
"\n Return the degree of the monomial index by ``m``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.degree_on_basis(R.one_basis())\n 0\n sage: f = (x + y)^3 + z^3\n sage: f.degree()\n 3\n "
return sum(m.list())
def dimension(self):
"\n Return the dimension of ``self``, which is `\\infty`.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.dimension()\n +Infinity\n "
return infinity
def q(self):
"\n Return the parameter `q`.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.q() == q\n True\n "
return self._q
|
class qCommutingPolynomials(qCommutingPolynomials_generic):
"\n The algebra of `q`-commuting polynomials.\n\n Let `R` be a commutative ring, and fix an element `q \\in R`. Let\n `B = (B_{xy})_{x,y \\in I}` be a skew-symmetric bilinear form with\n index set `I`. Let `R[I]_{q,B}` denote the polynomial ring in the variables\n `I` such that we have the `q`-*commuting* relation for `x, y \\in I`:\n\n .. MATH::\n\n y x = q^{B_{xy}} \\cdot x y.\n\n This is a graded `R`-algebra with a natural basis given by monomials\n written in increasing order with respect to some total order on `I`.\n\n When `B_{xy} = 1` and `B_{yx} = -1` for all `x < y`, then we have\n a `q`-analog of the classical binomial coefficient theorem:\n\n .. MATH::\n\n (x + y)^n = \\sum_{k=0}^n \\binom{n}{k}_q x^k y^{n-k}.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y> = algebras.qCommutingPolynomials(q)\n\n We verify a case of the `q`-binomial theorem::\n\n sage: f = (x + y)^10\n sage: all(f[b] == q_binomial(10, b.list()[0]) for b in f.support())\n True\n\n We now do a computation with a non-standard `B` matrix::\n\n sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])\n sage: B\n [ 0 1 2]\n [-1 0 3]\n [-2 -3 0]\n sage: q = ZZ['q'].gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q, B)\n sage: y * x\n q*x*y\n sage: z * x\n q^2*x*z\n sage: z * y\n q^3*y*z\n\n sage: f = (x + z)^10\n sage: all(f[b] == q_binomial(10, b.list()[0], q^2) for b in f.support())\n True\n\n sage: f = (y + z)^10\n sage: all(f[b] == q_binomial(10, b.list()[1], q^3) for b in f.support())\n True\n "
def __init__(self, q, B, names):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: TestSuite(R).run()\n "
indices = FreeAbelianMonoid(len(names), names)
qCommutingPolynomials_generic.__init__(self, q, B, indices, indices.variable_names())
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R\n q-commuting polynomial ring in x, y, z over Fraction Field of\n Univariate Polynomial Ring in q over Integer Ring with matrix:\n [ 0 1 1]\n [-1 0 1]\n [-1 -1 0]\n "
names = ', '.join(self.variable_names())
return '{}-commuting polynomial ring in {} over {} with matrix:\n{}'.format(self._q, names, self.base_ring(), self._B)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: latex(R)\n \\mathrm{Frac}(\\Bold{Z}[q])[x, y, z]_{q}\n "
names = ', '.join(self.variable_names())
return '{}[{}]_{{{}}}'.format(latex(self.base_ring()), names, self._q)
@cached_method
def one_basis(self):
"\n Return the basis index of the element `1`.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.one_basis()\n 1\n "
return self._indices.one()
def product_on_basis(self, x, y):
"\n Return the product of two monomials given by ``x`` and ``y``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y> = algebras.qCommutingPolynomials(q)\n sage: R.product_on_basis(x.leading_support(), y.leading_support())\n x*y\n sage: R.product_on_basis(y.leading_support(), x.leading_support())\n q*x*y\n\n sage: x * y\n x*y\n sage: y * x\n q*x*y\n sage: y^2 * x\n q^2*x*y^2\n sage: y * x^2\n q^2*x^2*y\n sage: x * y * x\n q*x^2*y\n sage: y^2 * x^2\n q^4*x^2*y^2\n sage: (x + y)^2\n x^2 + (q+1)*x*y + y^2\n sage: (x + y)^3\n x^3 + (q^2+q+1)*x^2*y + (q^2+q+1)*x*y^2 + y^3\n sage: (x + y)^4\n x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4\n\n With a non-standard `B` matrix::\n\n sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q, B=B)\n sage: x * y\n x*y\n sage: y * x^2\n q^2*x^2*y\n sage: z^2 * x\n q^4*x*z^2\n sage: z^2 * x^3\n q^12*x^3*z^2\n sage: z^2 * y\n q^6*y*z^2\n sage: z^2 * y^3\n q^18*y^3*z^2\n "
if (x == self.one_basis()):
return self.monomial(y)
if (y == self.one_basis()):
return self.monomial(x)
Lx = x.list()
Ly = y.list()
B = self._B
qpow = sum(((exp * sum(((B[(j, i)] * val) for (j, val) in enumerate(Ly[:i])))) for (i, exp) in enumerate(Lx) if exp))
return self.term((x * y), (self._q ** qpow))
|
class qCommutingLaurentPolynomials(qCommutingPolynomials_generic):
"\n The algebra of `q`-commuting Laurent polynomials.\n\n Let `R` be a commutative ring, and fix an element `q \\in R`. Let\n `B = (B_{xy})_{x,y \\in I}` be a skew-symmetric bilinear form with\n index set `I`. Let `R[I]_{q,B}` denote the Laurent polynomial ring in\n the variables `I` such that we have the `q`-*commuting* relation\n for `x, y \\in I`:\n\n .. MATH::\n\n y x = q^{B_{xy}} \\cdot x y.\n\n This is a graded `R`-algebra with a natural basis given by monomials\n written in increasing order with respect to some total order on `I`.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y> = algebras.qCommutingLaurentPolynomials(q)\n\n We verify a case of the `q`-binomial theorem using inverse variables::\n\n sage: f = (x^-1 + y^-1)^10\n sage: all(f[b] == q_binomial(10, -b.list()[0]) for b in f.support())\n True\n\n We now do a computation with a non-standard `B` matrix::\n\n sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])\n sage: B\n [ 0 1 2]\n [-1 0 3]\n [-2 -3 0]\n sage: q = ZZ['q'].gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q, B)\n sage: y^-1 * x\n 1/q*x*y^-1\n sage: z^-1 * x\n 1/q^2*x*z^-1\n sage: z^-1 * y^-1\n q^3*y^-1*z^-1\n\n sage: f = (x + z^-1)^10\n sage: all(f[b] == q_binomial(10, b.list()[0], q^-2) for b in f.support())\n True\n\n sage: f = (y^-1 + z^-1)^10\n sage: all(f[b] == q_binomial(10, -b.list()[1], q^3) for b in f.support())\n True\n "
def __init__(self, q, B, names):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q)\n sage: TestSuite(R).run()\n "
indices = FreeModule(ZZ, len(names))
self._display_group = FreeGroup(names=names, abelian=True, bracket=False)
qCommutingPolynomials_generic.__init__(self, q, B, indices, names)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q)\n sage: R\n q-commuting Laurent polynomial ring in x, y, z over Fraction Field of\n Univariate Polynomial Ring in q over Integer Ring with matrix:\n [ 0 1 1]\n [-1 0 1]\n [-1 -1 0]\n "
names = ', '.join(self.variable_names())
return '{}-commuting Laurent polynomial ring in {} over {} with matrix:\n{}'.format(self._q, names, self.base_ring(), self._B)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q)\n sage: latex(R)\n \\mathrm{Frac}(\\Bold{Z}[q])[x^{\\pm}, y^{\\pm}, z^{\\pm}]_{q}\n "
from sage.misc.latex import latex
names = ', '.join(('{}^{{\\pm}}'.format(v) for v in self.variable_names()))
return '{}[{}]_{{{}}}'.format(latex(self.base_ring()), names, self._q)
def _repr_term(self, m):
"\n Return a latex representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<w,x,y,z> = algebras.qCommutingLaurentPolynomials(q)\n sage: R._repr_term(R._indices([1,-2,0,3]))\n 'w*x^-2*z^3'\n sage: R._repr_term(R.zero())\n '1'\n sage: q^3 * R.one()\n q^3\n "
if (not m):
return '1'
G = self._display_group
return repr(G.prod(((g ** val) for (g, val) in zip(G.gens(), m) if (val != 0))))
def _latex_term(self, m):
"\n Return a latex representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<w,x,y,z> = algebras.qCommutingLaurentPolynomials(q)\n sage: R._latex_term(R._indices([1,-2,0,3]))\n w x^{-2} z^{3}\n sage: R._latex_term(R.zero())\n '1'\n sage: latex(q^3 * R.one())\n q^{3}\n "
if (not m):
return '1'
G = self._display_group
return latex(G.prod(((g ** val) for (g, val) in zip(G.gens(), m) if (val != 0))))
@cached_method
def one_basis(self):
"\n Return the basis index of the element `1`.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)\n sage: R.one_basis()\n 1\n "
return self._indices.zero()
def product_on_basis(self, x, y):
"\n Return the product of two monomials given by ``x`` and ``y``.\n\n EXAMPLES::\n\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y> = algebras.qCommutingLaurentPolynomials(q)\n sage: R.product_on_basis(x.leading_support(), y.leading_support())\n x*y\n sage: R.product_on_basis(y.leading_support(), x.leading_support())\n q*x*y\n\n sage: x * y\n x*y\n sage: y * x\n q*x*y\n sage: y^2 * x\n q^2*x*y^2\n sage: y * x^2\n q^2*x^2*y\n sage: y^-2 * x\n 1/q^2*x*y^-2\n sage: y * x^-2\n 1/q^2*x^-2*y\n sage: x * y * x\n q*x^2*y\n sage: x * y * ~x\n 1/q*y\n sage: y^2 * x^2\n q^4*x^2*y^2\n sage: y^-2 * x^2\n 1/q^4*x^2*y^-2\n sage: y^-2 * x^-2\n q^4*x^-2*y^-2\n sage: (x + y)^4\n x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4\n\n With a non-standard `B` matrix::\n\n sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q, B=B)\n sage: x * y\n x*y\n sage: y * x^2\n q^2*x^2*y\n sage: z^2 * x\n q^4*x*z^2\n sage: z^2 * x^3\n q^12*x^3*z^2\n sage: z^2 * y\n q^6*y*z^2\n sage: z^2 * y^3\n q^18*y^3*z^2\n sage: x * y^-1\n x*y^-1\n sage: y * x^-2\n 1/q^2*x^-2*y\n sage: z^-2 * x\n 1/q^4*x*z^-2\n sage: z^-2 * x^-3\n q^12*x^-3*z^-2\n sage: z^2 * y^-1\n 1/q^6*y^-1*z^2\n sage: z^2 * y^-3\n 1/q^18*y^-3*z^2\n "
if (x == self.one_basis()):
return self.monomial(y)
if (y == self.one_basis()):
return self.monomial(x)
B = self._B
qpow = sum(((exp * sum(((B[(j, i)] * y[j]) for j in range(i)))) for (i, exp) in enumerate(x) if exp))
ret = (x + y)
ret.set_immutable()
return self.term(ret, (self._q ** qpow))
class Element(qCommutingPolynomials_generic.Element):
def __invert__(self):
"\n Return the (multiplicative) inverse of ``self``.\n\n EXAMPLES::\n\n sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])\n sage: q = ZZ['q'].fraction_field().gen()\n sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q, B=B)\n sage: ~x\n x^-1\n sage: ~(x * y^-2)\n 1/q^2*x^-1*y^2\n sage: for a, b in cartesian_product([R.gens(), R.gens()]):\n ....: elt = a * b\n ....: assert ~elt * elt == R.one(), elt\n ....: assert elt * ~elt == R.one(), elt\n sage: elt = x^2 * y^-3 * z\n sage: ~elt\n 1/q^11*x^-2*y^3*z^-1\n sage: elt * ~elt == ~elt * elt == R.one()\n True\n "
if (len(self._monomial_coefficients) == 1):
P = self.parent()
B = P._B
q = P._q
(m, c) = next(iter(self._monomial_coefficients.items()))
ret = (- m)
n = len(m)
qpow = sum(((exp * sum(((B[(j, i)] * m[j]) for j in range((i + 1), n)))) for (i, exp) in enumerate(m) if exp))
ret.set_immutable()
return P.term(ret, ((~ c) * (q ** (- qpow))))
return super().__invert__()
|
class QSystem(CombinatorialFreeModule):
"\n A Q-system.\n\n Let `\\mathfrak{g}` be a tamely-laced symmetrizable Kac-Moody algebra\n with index set `I` and Cartan matrix `(C_{ab})_{a,b \\in I}` over a\n field `k`. Follow the presentation given in [HKOTY1999]_, an\n unrestricted Q-system is a `k`-algebra in infinitely many variables\n `Q^{(a)}_m`, where `a \\in I` and `m \\in \\ZZ_{>0}`, that satisfies\n the relations\n\n .. MATH::\n\n \\left(Q^{(a)}_m\\right)^2 = Q^{(a)}_{m+1} Q^{(a)}_{m-1} +\n \\prod_{b \\sim a} \\prod_{k=0}^{-C_{ab} - 1}\n Q^{(b)}_{\\left\\lfloor \\frac{m C_{ba} - k}{C_{ab}} \\right\\rfloor},\n\n with `Q^{(a)}_0 := 1`. Q-systems can be considered as T-systems where\n we forget the spectral parameter `u` and for `\\mathfrak{g}` of finite\n type, have a solution given by the characters of Kirillov-Reshetikhin\n modules (again without the spectral parameter) for an affine Kac-Moody\n algebra `\\widehat{\\mathfrak{g}}` with `\\mathfrak{g}` as its classical\n subalgebra. See [KNS2011]_ for more information.\n\n Q-systems have a natural bases given by polynomials of the\n fundamental representations `Q^{(a)}_1`, for `a \\in I`. As such, we\n consider the Q-system as generated by `\\{ Q^{(a)}_1 \\}_{a \\in I}`.\n\n There is also a level `\\ell` restricted Q-system (with unit boundary\n condition) given by setting `Q_{d_a \\ell}^{(a)} = 1`, where `d_a`\n are the entries of the symmetrizing matrix for the dual type of\n `\\mathfrak{g}`.\n\n Similarly, for twisted affine types (we omit type `A_{2n}^{(2)}`),\n we can define the *twisted Q-system* by using the relation:\n\n .. MATH::\n\n (Q^{(a)}_{m})^2 = Q^{(a)}_{m+1} Q^{(a)}_{m-1}\n + \\prod_{b \\neq a} (Q^{(b)}_{m})^{-C_{ba}}.\n\n See [Wil2013]_ for more information.\n\n EXAMPLES:\n\n We begin by constructing a Q-system and doing some basic computations\n in type `A_4`::\n\n sage: Q = QSystem(QQ, ['A', 4])\n sage: Q.Q(3,1)\n Q^(3)[1]\n sage: Q.Q(1,2)\n Q^(1)[1]^2 - Q^(2)[1]\n sage: Q.Q(3,3)\n -Q^(1)[1]*Q^(3)[1] + Q^(1)[1]*Q^(4)[1]^2 + Q^(2)[1]^2\n - 2*Q^(2)[1]*Q^(3)[1]*Q^(4)[1] + Q^(3)[1]^3\n sage: x = Q.Q(1,1) + Q.Q(2,1); x\n Q^(1)[1] + Q^(2)[1]\n sage: x * x\n Q^(1)[1]^2 + 2*Q^(1)[1]*Q^(2)[1] + Q^(2)[1]^2\n\n Next we do some basic computations in type `C_4`::\n\n sage: Q = QSystem(QQ, ['C', 4])\n sage: Q.Q(4,1)\n Q^(4)[1]\n sage: Q.Q(1,2)\n Q^(1)[1]^2 - Q^(2)[1]\n sage: Q.Q(2,3)\n Q^(1)[1]^2*Q^(4)[1] - 2*Q^(1)[1]*Q^(2)[1]*Q^(3)[1]\n + Q^(2)[1]^3 - Q^(2)[1]*Q^(4)[1] + Q^(3)[1]^2\n sage: Q.Q(3,3)\n Q^(1)[1]*Q^(4)[1]^2 - 2*Q^(2)[1]*Q^(3)[1]*Q^(4)[1] + Q^(3)[1]^3\n\n We compare that with the twisted Q-system of type `A_7^{(2)}`::\n\n sage: Q = QSystem(QQ, ['A',7,2], twisted=True)\n sage: Q.Q(4,1)\n Q^(4)[1]\n sage: Q.Q(1,2)\n Q^(1)[1]^2 - Q^(2)[1]\n sage: Q.Q(2,3)\n Q^(1)[1]^2*Q^(4)[1] - 2*Q^(1)[1]*Q^(2)[1]*Q^(3)[1]\n + Q^(2)[1]^3 - Q^(2)[1]*Q^(4)[1] + Q^(3)[1]^2\n sage: Q.Q(3,3)\n -Q^(1)[1]*Q^(3)[1]^2 + Q^(1)[1]*Q^(4)[1]^2 + Q^(2)[1]^2*Q^(3)[1]\n - 2*Q^(2)[1]*Q^(3)[1]*Q^(4)[1] + Q^(3)[1]^3\n\n REFERENCES:\n\n - [HKOTY1999]_\n - [KNS2011]_\n "
@staticmethod
def __classcall__(cls, base_ring, cartan_type, level=None, twisted=False):
"\n Normalize arguments to ensure a unique representation.\n\n EXAMPLES::\n\n sage: Q1 = QSystem(QQ, ['A',4])\n sage: Q2 = QSystem(QQ, 'A4')\n sage: Q1 is Q2\n True\n\n Twisted Q-systems are different from untwisted Q-systems::\n\n sage: Q1 = QSystem(QQ, ['E',6,2], twisted=True)\n sage: Q2 = QSystem(QQ, ['E',6,2])\n sage: Q1 is Q2\n False\n "
cartan_type = CartanType(cartan_type)
if (not is_tamely_laced(cartan_type)):
raise ValueError('the Cartan type is not tamely-laced')
if (twisted and (not cartan_type.is_affine()) and (not cartan_type.is_untwisted_affine())):
raise ValueError('the Cartan type must be of twisted type')
return super().__classcall__(cls, base_ring, cartan_type, level, twisted)
def __init__(self, base_ring, cartan_type, level, twisted):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',2])\n sage: TestSuite(Q).run()\n\n sage: Q = QSystem(QQ, ['E',6,2], twisted=True)\n sage: TestSuite(Q).run()\n "
self._cartan_type = cartan_type
self._level = level
self._twisted = twisted
indices = tuple(itertools.product(cartan_type.index_set(), [1]))
basis = IndexedFreeAbelianMonoid(indices, prefix='Q', bracket=False)
if self._twisted:
self._cm = cartan_type.classical().cartan_matrix()
else:
self._cm = cartan_type.cartan_matrix()
self._Irev = {ind: pos for (pos, ind) in enumerate(self._cm.index_set())}
self._poly = PolynomialRing(ZZ, [('q' + str(i)) for i in self._cm.index_set()])
category = Algebras(base_ring).Commutative().WithBasis()
CombinatorialFreeModule.__init__(self, base_ring, basis, prefix='Q', category=category)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: QSystem(QQ, ['A',4])\n Q-system of type ['A', 4] over Rational Field\n\n sage: QSystem(QQ, ['A',7,2], twisted=True)\n Twisted Q-system of type ['B', 4, 1]^* over Rational Field\n "
if (self._level is not None):
res = 'Restricted level {} '.format(self._level)
else:
res = ''
if self._twisted:
res += 'Twisted '
return '{}Q-system of type {} over {}'.format(res, self._cartan_type, self.base_ring())
def _repr_term(self, t):
"\n Return a string representation of the basis element indexed by ``t``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: I = Q._indices\n sage: Q._repr_term( I.gen((1,1)) * I.gen((4,1)) )\n 'Q^(1)[1]*Q^(4)[1]'\n "
if (len(t) == 0):
return '1'
def repr_gen(x):
ret = 'Q^({})[{}]'.format(*x[0])
if (x[1] > 1):
ret += '^{}'.format(x[1])
return ret
return '*'.join((repr_gen(x) for x in t._sorted_items()))
def _latex_term(self, t):
"\n Return a `\\LaTeX` representation of the basis element indexed\n by ``t``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: I = Q._indices\n sage: Q._latex_term( I.gen((3,1)) * I.gen((4,1)) )\n 'Q^{(3)}_{1} Q^{(4)}_{1}'\n "
if (len(t) == 0):
return '1'
def repr_gen(x):
ret = 'Q^{{({})}}_{{{}}}'.format(*x[0])
if (x[1] > 1):
ret = (('\\bigl(' + ret) + '\\bigr)^{{{}}}'.format(x[1]))
return ret
return ' '.join((repr_gen(x) for x in t._sorted_items()))
def _ascii_art_term(self, t):
"\n Return an ascii art representation of the term indexed by ``t``.\n\n TESTS::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: ascii_art(Q.an_element())\n 2 2 3\n (1) ( (1)) ( (2)) ( (3)) (2)\n 1 + 2*Q1 + (Q1 ) *(Q1 ) *(Q1 ) + 3*Q1\n "
from sage.typeset.ascii_art import AsciiArt
if (t == self.one_basis()):
return AsciiArt(['1'])
ret = AsciiArt('')
first = True
for (k, exp) in t._sorted_items():
if (not first):
ret += AsciiArt(['*'], baseline=0)
else:
first = False
(a, m) = k
var = AsciiArt([' ({})'.format(a), 'Q{}'.format(m)], baseline=0)
if (exp > 1):
var = ((AsciiArt(['(', '('], baseline=0) + var) + AsciiArt([')', ')'], baseline=0))
var = (AsciiArt([((' ' * len(var)) + str(exp))], baseline=(- 1)) * var)
ret += var
return ret
def _unicode_art_term(self, t):
"\n Return a unicode art representation of the term indexed by ``t``.\n\n TESTS::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: unicode_art(Q.an_element())\n 1 + 2*Q₁⁽¹⁾ + (Q₁⁽¹⁾)²(Q₁⁽²⁾)²(Q₁⁽³⁾)³ + 3*Q₁⁽²⁾\n "
from sage.typeset.unicode_art import UnicodeArt, unicode_subscript, unicode_superscript
if (t == self.one_basis()):
return UnicodeArt(['1'])
ret = UnicodeArt('')
for (k, exp) in t._sorted_items():
(a, m) = k
var = UnicodeArt([(((('Q' + unicode_subscript(m)) + '⁽') + unicode_superscript(a)) + '⁾')], baseline=0)
if (exp > 1):
var = ((UnicodeArt(['('], baseline=0) + var) + UnicodeArt([(')' + unicode_superscript(exp))], baseline=0))
ret += var
return ret
def cartan_type(self):
"\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.cartan_type()\n ['A', 4]\n\n sage: Q = QSystem(QQ, ['D',4,3], twisted=True)\n sage: Q.cartan_type()\n ['G', 2, 1]^* relabelled by {0: 0, 1: 2, 2: 1}\n "
return self._cartan_type
def index_set(self):
"\n Return the index set of ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.index_set()\n (1, 2, 3, 4)\n\n sage: Q = QSystem(QQ, ['D',4,3], twisted=True)\n sage: Q.index_set()\n (1, 2)\n "
return self._cm.index_set()
def level(self):
"\n Return the restriction level of ``self`` or ``None`` if\n the system is unrestricted.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.level()\n\n sage: Q = QSystem(QQ, ['A',4], 5)\n sage: Q.level()\n 5\n "
return self._level
@cached_method
def one_basis(self):
"\n Return the basis element indexing `1`.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.one_basis()\n 1\n sage: Q.one_basis().parent() is Q._indices\n True\n "
return self._indices.one()
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.algebra_generators()\n Finite family {1: Q^(1)[1], 2: Q^(2)[1], 3: Q^(3)[1], 4: Q^(4)[1]}\n\n sage: Q = QSystem(QQ, ['D',4,3], twisted=True)\n sage: Q.algebra_generators()\n Finite family {1: Q^(1)[1], 2: Q^(2)[1]}\n "
I = self._cm.index_set()
d = {a: self.Q(a, 1) for a in I}
return Family(I, d.__getitem__)
def gens(self):
"\n Return the generators of ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',4])\n sage: Q.gens()\n (Q^(1)[1], Q^(2)[1], Q^(3)[1], Q^(4)[1])\n "
return tuple(self.algebra_generators())
def dimension(self):
"\n Return the dimension of ``self``, which is `\\infty`.\n\n EXAMPLES::\n\n sage: F = QSystem(QQ, ['A',4])\n sage: F.dimension()\n +Infinity\n "
return infinity
def Q(self, a, m):
"\n Return the generator `Q^{(a)}_m` of ``self``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A', 8])\n sage: Q.Q(2, 1)\n Q^(2)[1]\n sage: Q.Q(6, 2)\n -Q^(5)[1]*Q^(7)[1] + Q^(6)[1]^2\n sage: Q.Q(7, 3)\n -Q^(5)[1]*Q^(7)[1] + Q^(5)[1]*Q^(8)[1]^2 + Q^(6)[1]^2\n - 2*Q^(6)[1]*Q^(7)[1]*Q^(8)[1] + Q^(7)[1]^3\n sage: Q.Q(1, 0)\n 1\n\n Twisted Q-system::\n\n sage: Q = QSystem(QQ, ['D',4,3], twisted=True)\n sage: Q.Q(1,2)\n Q^(1)[1]^2 - Q^(2)[1]\n sage: Q.Q(2,2)\n -Q^(1)[1]^3 + Q^(2)[1]^2\n sage: Q.Q(2,3)\n 3*Q^(1)[1]^4 - 2*Q^(1)[1]^3*Q^(2)[1] - 3*Q^(1)[1]^2*Q^(2)[1]\n + Q^(2)[1]^2 + Q^(2)[1]^3\n sage: Q.Q(1,4)\n -2*Q^(1)[1]^2 + 2*Q^(1)[1]^3 + Q^(1)[1]^4\n - 3*Q^(1)[1]^2*Q^(2)[1] + Q^(2)[1] + Q^(2)[1]^2\n "
if (a not in self._cartan_type.index_set()):
raise ValueError('a is not in the index set')
if (m == 0):
return self.one()
if self._level:
t = self._cartan_type.dual().cartan_matrix().symmetrizer()
if (m == (t[a] * self._level)):
return self.one()
if (m == 1):
return self.monomial(self._indices.gen((a, 1)))
I = self._cm.index_set()
p = self._Q_poly(a, m)
return p.subs({g: self.Q(I[i], 1) for (i, g) in enumerate(self._poly.gens())})
@cached_method
def _Q_poly(self, a, m):
"\n Return the element `Q^{(a)}_m` as a polynomial.\n\n We start with the relation\n\n .. MATH::\n\n (Q^{(a)}_{m-1})^2 = Q^{(a)}_m Q^{(a)}_{m-2} + \\mathcal{Q}_{a,m-1},\n\n which implies\n\n .. MATH::\n\n Q^{(a)}_m = \\frac{Q^{(a)}_{m-1}^2 - \\mathcal{Q}_{a,m-1}}{\n Q^{(a)}_{m-2}}.\n\n This becomes our relation used for reducing the Q-system to the\n fundamental representations.\n\n For twisted Q-systems, we use\n\n .. MATH::\n\n (Q^{(a)}_{m-1})^2 = Q^{(a)}_m Q^{(a)}_{m-2}\n + \\prod_{b \\neq a} (Q^{(b)}_{m-1})^{-A_{ba}}.\n\n .. NOTE::\n\n This helper method is defined in order to use the\n division implemented in polynomial rings.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',8])\n sage: Q._Q_poly(1, 2)\n q1^2 - q2\n sage: Q._Q_poly(3, 2)\n q3^2 - q2*q4\n sage: Q._Q_poly(6, 3)\n q6^3 - 2*q5*q6*q7 + q4*q7^2 + q5^2*q8 - q4*q6*q8\n\n Twisted types::\n\n sage: Q = QSystem(QQ, ['E',6,2], twisted=True)\n sage: Q._Q_poly(1,2)\n q1^2 - q2\n sage: Q._Q_poly(2,2)\n q2^2 - q1*q3\n sage: Q._Q_poly(3,2)\n -q2^2*q4 + q3^2\n sage: Q._Q_poly(4,2)\n q4^2 - q3\n sage: Q._Q_poly(3,3)\n 2*q1*q2^2*q4^2 - q1^2*q3*q4^2 + q2^4 - 2*q1*q2^2*q3\n + q1^2*q3^2 - 2*q2^2*q3*q4 + q3^3\n\n sage: Q = QSystem(QQ, ['D',4,3], twisted=True)\n sage: Q._Q_poly(1,2)\n q1^2 - q2\n sage: Q._Q_poly(2,2)\n -q1^3 + q2^2\n sage: Q._Q_poly(1,3)\n q1^3 + q1^2 - 2*q1*q2\n sage: Q._Q_poly(2,3)\n 3*q1^4 - 2*q1^3*q2 - 3*q1^2*q2 + q2^3 + q2^2\n "
if ((m == 0) or (m == self._level)):
return self._poly.one()
if (m == 1):
return self._poly.gen(self._Irev[a])
cm = self._cm
m -= 1
cur = (self._Q_poly(a, m) ** 2)
if self._twisted:
ret = prod(((self._Q_poly(b, m) ** (- cm[(self._Irev[b], self._Irev[a])])) for b in self._cm.dynkin_diagram().neighbors(a)))
else:
ret = self._poly.one()
i = self._Irev[a]
for b in self._cm.dynkin_diagram().neighbors(a):
j = self._Irev[b]
for k in range((- cm[(i, j)])):
ret *= self._Q_poly(b, (((m * cm[(j, i)]) - k) // cm[(i, j)]))
cur -= ret
if (m > 1):
cur //= self._Q_poly(a, (m - 1))
return cur
class Element(CombinatorialFreeModule.Element):
'\n An element of a Q-system.\n '
def _mul_(self, x):
"\n Return the product of ``self`` and ``x``.\n\n EXAMPLES::\n\n sage: Q = QSystem(QQ, ['A',8])\n sage: x = Q.Q(1, 2)\n sage: y = Q.Q(3, 2)\n sage: x * y\n -Q^(1)[1]^2*Q^(2)[1]*Q^(4)[1] + Q^(1)[1]^2*Q^(3)[1]^2\n + Q^(2)[1]^2*Q^(4)[1] - Q^(2)[1]*Q^(3)[1]^2\n "
return self.parent().sum_of_terms((((tl * tr), (cl * cr)) for (tl, cl) in self for (tr, cr) in x))
|
def is_tamely_laced(ct):
"\n Check if the Cartan type ``ct`` is tamely-laced.\n\n A (symmetrizable) Cartan type with index set `I` is *tamely-laced*\n if `A_{ij} < -1` implies `d_i = -A_{ji} = 1` for all `i,j \\in I`,\n where `(d_i)_{i \\in I}` is the diagonal matrix symmetrizing the\n Cartan matrix `(A_{ij})_{i,j \\in I}`.\n\n EXAMPLES::\n\n sage: from sage.algebras.q_system import is_tamely_laced\n sage: all(is_tamely_laced(ct)\n ....: for ct in CartanType.samples(crystallographic=True, finite=True))\n True\n sage: for ct in CartanType.samples(crystallographic=True, affine=True):\n ....: if not is_tamely_laced(ct):\n ....: print(ct)\n ['A', 1, 1]\n ['BC', 1, 2]\n ['BC', 5, 2]\n ['BC', 1, 2]^*\n ['BC', 5, 2]^*\n sage: cm = CartanMatrix([[2,-1,0,0],[-3,2,-2,-2],[0,-1,2,-1],[0,-1,-1,2]])\n sage: is_tamely_laced(cm)\n True\n "
if ct.is_finite():
return True
if ct.is_affine():
return (not ((ct is CartanType(['A', 1, 1])) or ((ct.type() == 'BC') or (ct.dual().type() == 'BC'))))
cm = ct.cartan_matrix()
d = cm.symmetrizer()
I = ct.index_set()
return all(((((- cm[(j, i)]) == 1) and (d[i] == 1)) for i in I for j in I if (cm[(i, j)] < (- 1))))
|
class QuantumCliffordAlgebra(CombinatorialFreeModule):
'\n The quantum Clifford algebra.\n\n The *quantum Clifford algebra*, or `q`-Clifford algebra,\n of rank `n` and twist `k` is the unital associative algebra\n `\\mathrm{Cl}_{q}(n, k)` over a field `F` with generators\n `\\psi_a, \\psi_a^*, \\omega_a` for `a = 1, \\ldots, n` that\n satisfy the following relations:\n\n .. MATH::\n\n \\begin{aligned}\n \\omega_a \\omega_b & = \\omega_b \\omega_a,\n & \\omega_a^{4k} & = (1 + q^{-2k}) \\omega_a^{2k} - q^{-2k},\n \\\\ \\omega_a \\psi_b & = q^{\\delta_{ab}} \\psi_b \\omega_a,\n & \\omega_a \\psi^*_b & = \\psi^*_b \\omega_a,\n \\\\ \\psi_a \\psi_b & + \\psi_b \\psi_a = 0,\n & \\psi^*_a \\psi^*_b & + \\psi^*_b \\psi^*_a = 0,\n \\\\ \\psi_a \\psi^*_a & + q^k \\psi^*_a \\psi_a = \\omega_a^{-k},\n & \\psi^*_a \\psi_a & + q^{-k} \\psi^*_a \\psi_a = \\omega_a^k,\n \\\\ \\psi_a \\psi^*_b & + \\psi_b^* \\psi_a = 0\n & & \\text{if } a \\neq b.\n \\end{aligned}\n\n When `k = 2`, we recover the original definition given by Hayashi in\n [Hayashi1990]_. The `k = 1` version was used in [Kwon2014]_.\n\n INPUT:\n\n - ``n`` -- positive integer; the rank\n - ``k`` -- positive integer (default: 1); the twist\n - ``q`` -- (optional) the parameter `q`\n - ``F`` -- (default: `\\QQ(q)`) the base field that contains ``q``\n\n EXAMPLES:\n\n We construct the rank 3 and twist 1 `q`-Clifford algebra::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl\n Quantum Clifford algebra of rank 3 and twist 1 with q=q over\n Fraction Field of Univariate Polynomial Ring in q over Integer Ring\n sage: q = Cl.q()\n\n Some sample computations::\n\n sage: p0, p1, p2, d0, d1, d2, w0, w1, w2 = Cl.gens()\n sage: p0 * p1\n psi0*psi1\n sage: p1 * p0\n -psi0*psi1\n sage: p0 * w0 * p1 * d0 * w2\n (1/(q^3-q))*psi1*w2 + (-q/(q^2-1))*psi1*w0^2*w2\n sage: w0^4\n -1/q^2 + ((q^2+1)/q^2)*w0^2\n\n We construct the homomorphism from `U_q(\\mathfrak{sl}_3)` to\n `\\mathrm{Cl}(3, 1)` given in (3.17) of [Hayashi1990]_::\n\n sage: e1 = p0*d1; e2 = p1*d2\n sage: f1 = p1*d0; f2 = p2*d1\n sage: k1 = w0*~w1; k2 = w1*~w2\n sage: k1i = w1*~w0; k2i = w2*~w1\n sage: (e1, e2, f1, f2, k1, k2, k1i, k2i)\n (psi0*psid1, psi1*psid2,\n -psid0*psi1, -psid1*psi2,\n (q^2+1)*w0*w1 - q^2*w0*w1^3, (q^2+1)*w1*w2 - q^2*w1*w2^3,\n (q^2+1)*w0*w1 - q^2*w0^3*w1, (q^2+1)*w1*w2 - q^2*w1^3*w2)\n\n We check that `k_i` and `k_i^{-1}` are inverses::\n\n sage: k1 * k1i\n 1\n sage: k2 * k2i\n 1\n\n The relations between `e_i`, `f_i`, and `k_i`::\n\n sage: k1 * f1 == q^-2 * f1 * k1\n True\n sage: k2 * f1 == q^1 * f1 * k2\n True\n sage: k2 * e1 == q^-1 * e1 * k2\n True\n sage: k1 * e1 == q^2 * e1 * k1\n True\n sage: e1 * f1 - f1 * e1 == (k1 - k1i)/(q-q^-1)\n True\n sage: e2 * f1 - f1 * e2\n 0\n\n The `q`-Serre relations::\n\n sage: e1 * e1 * e2 - (q^1 + q^-1) * e1 * e2 * e1 + e2 * e1 * e1\n 0\n sage: f1 * f1 * f2 - (q^1 + q^-1) * f1 * f2 * f1 + f2 * f1 * f1\n 0\n\n This also can be constructed at the special point when `q^{2k} = 1`,\n but the basis used is different::\n\n sage: Cl = algebras.QuantumClifford(1, 1, -1)\n sage: Cl.inject_variables()\n Defining psi0, psid0, w0\n sage: psi0 * psid0\n psi0*psid0\n sage: psid0 * psi0\n -w0 + psi0*psid0\n sage: w0^2\n 1\n '
@staticmethod
def __classcall_private__(cls, n, k=1, q=None, F=None):
"\n Standardize input to ensure a unique representation.\n\n TESTS::\n\n sage: Cl1 = algebras.QuantumClifford(3)\n sage: q = PolynomialRing(ZZ, 'q').fraction_field().gen()\n sage: Cl2 = algebras.QuantumClifford(3, q=q)\n sage: Cl3 = algebras.QuantumClifford(3, 1, q, q.parent())\n sage: Cl1 is Cl2 and Cl2 is Cl3\n True\n "
if (q is None):
q = PolynomialRing(ZZ, 'q').fraction_field().gen()
if (F is None):
F = q.parent()
q = F(q)
if (F not in Fields()):
F = FractionField(F)
q = F(q)
if bool(((q ** (2 * k)) == 1)):
return QuantumCliffordAlgebraRootUnity(n, k, q, F)
return QuantumCliffordAlgebraGeneric(n, k, q, F)
def __init__(self, n, k, q, F, psi, indices):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(1, 2)\n sage: TestSuite(Cl).run(elements=Cl.basis())\n '
self._n = n
self._k = k
self._q = q
self._w_poly = PolynomialRing(F, n, 'w')
self._psi = psi
indices = FiniteEnumeratedSet(indices)
cat = Algebras(F).FiniteDimensional().Semisimple().WithBasis()
CombinatorialFreeModule.__init__(self, F, indices, category=cat)
self._assign_names(self.algebra_generators().keys())
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: algebras.QuantumClifford(3)\n Quantum Clifford algebra of rank 3 and twist 1 with q=q over\n Fraction Field of Univariate Polynomial Ring in q over Integer Ring\n '
return 'Quantum Clifford algebra of rank {} and twist {} with q={} over {}'.format(self._n, self._k, self._q, self.base_ring())
def _latex_(self):
'\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: latex(Cl)\n \\operatorname{Cl}_{q}(3, 1)\n '
return ('\\operatorname{Cl}_{%s}(%s, %s)' % (self._q, self._n, self._k))
def q(self):
'\n Return the `q` of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.q()\n q\n\n sage: Cl = algebras.QuantumClifford(3, q=QQ(-5))\n sage: Cl.q()\n -5\n '
return self._q
def twist(self):
'\n Return the twist `k` of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 2)\n sage: Cl.twist()\n 2\n '
return self._k
def rank(self):
'\n Return the rank `k` of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 2)\n sage: Cl.rank()\n 3\n '
return self._n
def dimension(self):
'\n Return the dimension of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.dimension()\n 512\n\n sage: Cl = algebras.QuantumClifford(4, 2) # long time\n sage: Cl.dimension() # long time\n 65536\n '
return (ZZ((8 * self._k)) ** self._n)
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.algebra_generators()\n Finite family {'psi0': psi0, 'psi1': psi1, 'psi2': psi2,\n 'psid0': psid0, 'psid1': psid1, 'psid2': psid2,\n 'w0': w0, 'w1': w1, 'w2': w2}\n "
one = ((0,) * self._n)
zero = ([0] * self._n)
d = {}
for i in range(self._n):
r = list(zero)
r[i] = 1
d[('psi%s' % i)] = self.monomial((self._psi(r), one))
r[i] = (- 1)
d[('psid%s' % i)] = self.monomial((self._psi(r), one))
zero = self._psi(zero)
for i in range(self._n):
temp = list(zero)
temp[i] = 1
d[('w%s' % i)] = self.monomial((zero, tuple(temp)))
return Family(sorted(d), (lambda i: d[i]))
@cached_method
def gens(self):
'\n Return the generators of ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.gens()\n (psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2)\n '
return tuple(self.algebra_generators())
@cached_method
def one_basis(self):
'\n Return the index of the basis element of `1`.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.one_basis()\n ((0, 0, 0), (0, 0, 0))\n '
return (self._psi(([0] * self._n)), ((0,) * self._n))
|
class QuantumCliffordAlgebraGeneric(QuantumCliffordAlgebra):
'\n The quantum Clifford algebra when `q^{2k} \\neq 1`.\n\n The *quantum Clifford algebra*, or `q`-Clifford algebra,\n of rank `n` and twist `k` is the unital associative algebra\n `\\mathrm{Cl}_{q}(n, k)` over a field `F` with generators\n `\\psi_a, \\psi_a^*, \\omega_a` for `a = 1, \\ldots, n` that\n satisfy the following relations:\n\n .. MATH::\n\n \\begin{aligned}\n \\omega_a \\omega_b & = \\omega_b \\omega_a,\n & \\omega_a^{4k} & = (1 + q^{-2k}) \\omega_a^{2k} - q^{-2k},\n \\\\ \\omega_a \\psi_b & = q^{\\delta_{ab}} \\psi_b \\omega_a,\n & \\omega_a \\psi^*_b & = \\psi^*_b \\omega_a,\n \\\\ \\psi_a \\psi_b & + \\psi_b \\psi_a = 0,\n & \\psi^*_a \\psi^*_b & + \\psi^*_b \\psi^*_a = 0,\n \\\\ \\psi_a \\psi^*_a & = \\frac{q^k \\omega_a^{3k} - q^{-k} \\omega_a^k}{q^k - q^{-k}},\n & \\psi^*_a \\psi_a & = \\frac{q^{2k} (\\omega_a - \\omega_a^{3k})}{q^k - q^{-k}},\n \\\\ \\psi_a \\psi^*_b & + \\psi_b^* \\psi_a = 0\n & & \\text{if } a \\neq b,\n \\end{aligned}\n\n where `q \\in F` such that `q^{2k} \\neq 1`.\n\n When `k = 2`, we recover the original definition given by Hayashi in\n [Hayashi1990]_. The `k = 1` version was used in [Kwon2014]_.\n '
def __init__(self, n, k, q, F):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: Cl = algebras.QuantumClifford(1,3)\n sage: TestSuite(Cl).run(elements=Cl.basis()) # long time\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: elts = Cl.some_elements() + list(Cl.algebra_generators())\n sage: TestSuite(Cl).run(elements=elts) # long time\n\n sage: Cl = algebras.QuantumClifford(2, 4)\n sage: elts = Cl.some_elements() + list(Cl.algebra_generators())\n sage: TestSuite(Cl).run(elements=elts) # long time\n '
psi = cartesian_product(([((- 1), 0, 1)] * n))
indices = [(tuple(p), tuple(w)) for p in psi for w in product(*[list(range(((4 - (2 * abs(p[i]))) * k))) for i in range(n)])]
super().__init__(n, k, q, F, psi, indices)
def _repr_term(self, m):
"\n Return a string representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 3)\n sage: Cl._repr_term( ((1, 0, -1), (0, 2, 5)) )\n 'psi0*psid2*w1^2*w2^5'\n sage: Cl._repr_term( ((1, 0, -1), (0, 0, 0)) )\n 'psi0*psid2'\n sage: Cl._repr_term( ((0, 0, 0), (0, 2, 5)) )\n 'w1^2*w2^5'\n sage: Cl._repr_term( ((0, 0, 0), (0, 0, 0)) )\n '1'\n\n sage: Cl(5)\n 5\n "
(p, v) = m
rp = '*'.join(((('psi%s' % i) if (p[i] > 0) else ('psid%s' % i)) for i in range(self._n) if (p[i] != 0)))
gen_str = (lambda e: ('' if (e == 1) else ('^%s' % e)))
rv = '*'.join(((('w%s' % i) + gen_str(v[i])) for i in range(self._n) if (v[i] != 0)))
if rp:
if rv:
return ((rp + '*') + rv)
return rp
if rv:
return rv
return '1'
def _latex_term(self, m):
"\n Return a latex representation for the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 3)\n sage: Cl._latex_term( ((1, 0, -1), (0, -2, 5)) )\n '\\\\psi_{0}\\\\psi^{\\\\dagger}_{2}\\\\omega_{1}^{-2}\\\\omega_{2}^{5}'\n sage: Cl._latex_term( ((1, 0, -1), (0, 0, 0)) )\n '\\\\psi_{0}\\\\psi^{\\\\dagger}_{2}'\n sage: Cl._latex_term( ((0, 0, 0), (0, -2, 5)) )\n '\\\\omega_{1}^{-2}\\\\omega_{2}^{5}'\n sage: Cl._latex_term( ((0, 0, 0), (0, 0, 0)) )\n '1'\n\n sage: latex(Cl(5))\n 5\n "
(p, v) = m
rp = ''.join(((('\\psi_{%s}' % i) if (p[i] > 0) else ('\\psi^{\\dagger}_{%s}' % i)) for i in range(self._n) if (p[i] != 0)))
gen_str = (lambda e: ('' if (e == 1) else ('^{%s}' % e)))
rv = ''.join(((('\\omega_{%s}' % i) + gen_str(v[i])) for i in range(self._n) if (v[i] != 0)))
if ((not rp) and (not rv)):
return '1'
return (rp + rv)
@cached_method
def product_on_basis(self, m1, m2):
'\n Return the product of the basis elements indexed by ``m1`` and ``m2``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2\n sage: psi0^2 # indirect doctest\n 0\n sage: psid0^2\n 0\n sage: w0 * psi0\n q*psi0*w0\n sage: w0 * psid0\n 1/q*psid0*w0\n sage: w2 * w0\n w0*w2\n sage: w0^4\n -1/q^2 + ((q^2+1)/q^2)*w0^2\n '
(p1, w1) = m1
(p2, w2) = m2
if any((((p1[i] != 0) and (p1[i] == p2[i])) for i in range(self._n))):
return self.zero()
k = self._k
q_power = 0
sign = 1
pairings = []
supported = []
p = ([0] * self._n)
for i in range(self._n):
if (p2[i] != 0):
supported.append(i)
q_power += (w1[i] * p2[i])
if (p1[i] != 0):
pairings.append(((i + 1) * p1[i]))
p[i] = (p1[i] + p2[i])
supported.append((self._n - 1))
for i in reversed(range(1, len(supported))):
if ((i % 2) != 0):
for j in reversed(range((supported[(i - 1)] + 1), (supported[i] + 1))):
if (p1[j] != 0):
sign = (((- 1) ** i) * sign)
vp = self._w_poly.gens()
poly = self._w_poly.one()
q = self._q
for i in pairings:
if (i < 0):
i = ((- i) - 1)
vpik = (((- (q ** (2 * k))) * (vp[i] ** (3 * k))) + ((1 + (q ** (2 * k))) * (vp[i] ** k)))
poly *= ((- ((vp[i] ** k) - vpik)) / ((q ** k) - (q ** (- k))))
else:
i -= 1
vpik = (((- (q ** (2 * k))) * (vp[i] ** (3 * k))) + ((1 + (q ** (2 * k))) * (vp[i] ** k)))
poly *= ((((q ** k) * (vp[i] ** k)) - ((q ** (- k)) * vpik)) / ((q ** k) - (q ** (- k))))
v = list(w1)
for i in range(self._n):
v[i] += w2[i]
for i in range(self._n):
if ((p[i] > 0) and (v[i] != 0)):
q_power -= ((2 * k) * (v[i] // (2 * k)))
v[i] = (v[i] % (2 * k))
if ((p[i] < 0) and (v[i] != 0)):
v[i] = (v[i] % (2 * k))
poly *= self._w_poly.monomial(*v)
poly = poly.reduce([(((vp[i] ** (4 * k)) - ((1 + (q ** ((- 2) * k))) * (vp[i] ** (2 * k)))) + (q ** ((- 2) * k))) for i in range(self._n)])
pdict = poly.dict()
ret = {(self._psi(p), tuple(e)): ((pdict[e] * (q ** q_power)) * sign) for e in pdict}
return self._from_dict(ret)
class Element(CombinatorialFreeModule.Element):
def inverse(self):
'\n Return the inverse if ``self`` is a basis element.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(2)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psid0, psid1, w0, w1\n sage: w0^-1\n (q^2+1)*w0 - q^2*w0^3\n sage: w0^-1 * w0\n 1\n sage: w0^-2\n (q^2+1) - q^2*w0^2\n sage: w0^-2 * w0^2\n 1\n sage: w0^-2 * w0 == w0^-1\n True\n sage: w = w0 * w1\n sage: w^-1\n (q^4+2*q^2+1)*w0*w1 + (-q^4-q^2)*w0*w1^3\n + (-q^4-q^2)*w0^3*w1 + q^4*w0^3*w1^3\n sage: w^-1 * w\n 1\n sage: w * w^-1\n 1\n\n sage: (2*w0)^-1\n ((q^2+1)/2)*w0 - q^2/2*w0^3\n\n sage: (w0 + w1)^-1\n Traceback (most recent call last):\n ...\n ValueError: cannot invert self (= w1 + w0)\n sage: (psi0 * w0)^-1\n Traceback (most recent call last):\n ...\n ValueError: cannot invert self (= psi0*w0)\n\n sage: Cl = algebras.QuantumClifford(1, 2)\n sage: Cl.inject_variables()\n Defining psi0, psid0, w0\n sage: (psi0 + psid0).inverse()\n psid0*w0^2 + q^2*psi0*w0^2\n\n sage: Cl = algebras.QuantumClifford(2, 2)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psid0, psid1, w0, w1\n sage: w0^-1\n (q^4+1)*w0^3 - q^4*w0^7\n sage: w0 * w0^-1\n 1\n '
if (not self):
raise ZeroDivisionError
if (len(self) != 1):
return super().__invert__()
Cl = self.parent()
(((p, w), coeff),) = list(self._monomial_coefficients.items())
if any(((p[i] != 0) for i in range(Cl._n))):
return super().__invert__()
poly = Cl._w_poly.monomial(*w)
wp = Cl._w_poly.gens()
q = Cl._q
k = Cl._k
poly = poly.subs({wi: (((- (q ** (2 * k))) * (wi ** ((4 * k) - 1))) + ((1 + (q ** (2 * k))) * (wi ** ((2 * k) - 1)))) for wi in wp})
poly = poly.reduce([(((wi ** (4 * k)) - ((1 + (q ** ((- 2) * k))) * (wi ** (2 * k)))) + (q ** ((- 2) * k))) for wi in wp])
pdict = poly.dict()
coeff = coeff.inverse_of_unit()
ret = {(p, tuple(e)): (coeff * c) for (e, c) in pdict.items()}
return Cl.element_class(Cl, ret)
__invert__ = inverse
|
class QuantumCliffordAlgebraRootUnity(QuantumCliffordAlgebra):
'\n The quantum Clifford algebra when `q^{2k} = 1`.\n\n The *quantum Clifford algebra*, or `q`-Clifford algebra,\n of rank `n` and twist `k` is the unital associative algebra\n `\\mathrm{Cl}_{q}(n, k)` over a field `F` with generators\n `\\psi_a, \\psi_a^*, \\omega_a` for `a = 1, \\ldots, n` that\n satisfy the following relations:\n\n .. MATH::\n\n \\begin{aligned}\n \\omega_a \\omega_b & = \\omega_b \\omega_a,\n & \\omega_a^{2k} & = 1,\n \\\\ \\omega_a \\psi_b & = q^{\\delta_{ab}} \\psi_b \\omega_a,\n & \\omega_a \\psi^*_b & = \\psi^*_b \\omega_a,\n \\\\ \\psi_a \\psi_b & + \\psi_b \\psi_a = 0,\n & \\psi^*_a \\psi^*_b & + \\psi^*_b \\psi^*_a = 0,\n \\\\ \\psi_a \\psi^*_a & + q^k \\psi^*_a \\psi_a = \\omega_a^k\n & \\psi_a \\psi^*_b & + \\psi_b^* \\psi_a = 0 \\quad (a \\neq b),\n \\end{aligned}\n\n where `q \\in F` such that `q^{2k} = 1`. This has further relations of\n\n .. MATH::\n\n \\begin{aligned}\n \\psi^*_a \\psi_a \\psi^*_a & = \\psi^*_a \\omega_a^k,\n \\\\\n \\psi_a \\psi^*_a \\psi_a & = q^k \\psi_a \\omega_a^k,\n \\\\\n (\\psi_a \\psi^*_a)^2 & = \\psi_a \\psi^*_a \\omega_a^k.\n \\end{aligned}\n '
def __init__(self, n, k, q, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(1,2,-1)\n sage: TestSuite(Cl).run(elements=Cl.basis())\n\n sage: z = CyclotomicField(3).gen()\n sage: Cl = algebras.QuantumClifford(1,3,z)\n sage: TestSuite(Cl).run(elements=Cl.basis())\n\n sage: Cl = algebras.QuantumClifford(3,1,-1)\n sage: elts = Cl.some_elements() + list(Cl.algebra_generators())\n sage: TestSuite(Cl).run(elements=elts) # long time\n\n sage: Cl = algebras.QuantumClifford(2,4,-1)\n sage: elts = Cl.some_elements() + list(Cl.algebra_generators())\n sage: TestSuite(Cl).run(elements=elts) # long time\n '
psi = cartesian_product(([((- 1), 0, 1, 2)] * n))
indices = [(tuple(p), tuple(w)) for p in psi for w in product(list(range((2 * k))), repeat=n)]
super().__init__(n, k, q, F, psi, indices)
def _repr_term(self, m):
"\n Return a string representation of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 3, -1)\n sage: Cl._repr_term( ((1, 0, -1), (0, 2, 5)) )\n 'psi0*psid2*w1^2*w2^5'\n sage: Cl._repr_term( ((1, 0, 2), (0, 0, 0)) )\n 'psi0*psi2*psid2'\n sage: Cl._repr_term( ((0, 0, 0), (0, 2, 5)) )\n 'w1^2*w2^5'\n sage: Cl._repr_term( ((0, 0, 0), (0, 0, 0)) )\n '1'\n\n sage: Cl(5)\n 5\n "
(p, v) = m
def ppr(i):
val = p[i]
if (val == (- 1)):
return ('psid%s' % i)
elif (val == 1):
return ('psi%s' % i)
elif (val == 2):
return ('psi%s*psid%s' % (i, i))
rp = '*'.join((ppr(i) for i in range(self._n) if (p[i] != 0)))
gen_str = (lambda e: ('' if (e == 1) else ('^%s' % e)))
rv = '*'.join(((('w%s' % i) + gen_str(v[i])) for i in range(self._n) if (v[i] != 0)))
if rp:
if rv:
return ((rp + '*') + rv)
return rp
if rv:
return rv
return '1'
def _latex_term(self, m):
"\n Return a latex representation for the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 3, -1)\n sage: Cl._latex_term( ((1, 0, -1), (0, 2, 5)) )\n '\\\\psi_{0}\\\\psi^{\\\\dagger}_{2}\\\\omega_{1}^{2}\\\\omega_{2}^{5}'\n sage: Cl._latex_term( ((1, 0, 2), (0, 0, 0)) )\n '\\\\psi_{0}\\\\psi_{2}\\\\psi^{\\\\dagger}_{2}'\n sage: Cl._latex_term( ((0, 0, 0), (0, 2, 5)) )\n '\\\\omega_{1}^{2}\\\\omega_{2}^{5}'\n sage: Cl._latex_term( ((0, 0, 0), (0, 0, 0)) )\n '1'\n\n sage: latex(Cl(5))\n 5\n "
(p, v) = m
def ppr(i):
val = p[i]
if (val == (- 1)):
return ('\\psi^{\\dagger}_{%s}' % i)
elif (val == 1):
return ('\\psi_{%s}' % i)
elif (val == 2):
return ('\\psi_{%s}\\psi^{\\dagger}_{%s}' % (i, i))
rp = ''.join((ppr(i) for i in range(self._n) if (p[i] != 0)))
gen_str = (lambda e: ('' if (e == 1) else ('^{%s}' % e)))
rv = ''.join(((('\\omega_{%s}' % i) + gen_str(v[i])) for i in range(self._n) if (v[i] != 0)))
if ((not rp) and (not rv)):
return '1'
return (rp + rv)
@cached_method
def product_on_basis(self, m1, m2):
'\n Return the product of the basis elements indexed by ``m1`` and ``m2``.\n\n EXAMPLES::\n\n sage: z = CyclotomicField(3).gen()\n sage: Cl = algebras.QuantumClifford(3, 3, z)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2\n sage: psi0^2 # indirect doctest\n 0\n sage: psid0^2\n 0\n sage: w0 * psi0\n -(-zeta3)*psi0*w0\n sage: w0 * psid0\n -(zeta3+1)*psid0*w0\n sage: psi0 * psid0\n psi0*psid0\n sage: psid0 * psi0\n w0^3 - psi0*psid0\n sage: w2 * w0\n w0*w2\n sage: w0^6\n 1\n sage: psi0 * psi1\n psi0*psi1\n sage: psi1 * psi0\n -psi0*psi1\n sage: psi1 * (psi0 * psi2)\n -psi0*psi1*psi2\n\n sage: z = CyclotomicField(6).gen()\n sage: Cl = algebras.QuantumClifford(3, 3, z)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2\n\n sage: psid1 * (psi1 * psid1)\n psid1*w1^3\n sage: (psi1* psid1) * (psi1 * psid1)\n psi1*psid1*w1^3\n sage: (psi1 * psid1) * psi1\n -psi1*w1^3\n '
(p1, w1) = m1
(p2, w2) = m2
k = self._k
tk = (2 * k)
if any((((((p1[i] % 2) != 0) and (p1[i] == p2[i])) or ((p1[i] == 2) and (p2[i] == (- 1))) or ((p2[i] == 2) and (p1[i] == 1))) for i in range(self._n))):
return self.zero()
v = [((w1[i] + w2[i]) % tk) for i in range(self._n)]
q_power = 0
sign = 1
pairings = []
p = ([0] * self._n)
num_cross = 0
total_cross = 0
for i in range(self._n):
num_cross += p2[i]
if (p2[i] == 2):
if (p1[i] != 0):
v[i] = ((v[i] + k) % tk)
p[i] = p1[i]
else:
p[i] = p2[i]
elif (p2[i] != 0):
q_power += (w1[i] * p2[i])
if (p1[i] == (- 1)):
pairings.append(i)
total_cross -= 1
p[i] = None
elif (p1[i] == 1):
total_cross -= 1
p[i] = 2
elif (p1[i] == 2):
q_power += k
v[i] = ((v[i] + k) % tk)
p[i] = p2[i]
else:
p[i] = p2[i]
else:
p[i] = p1[i]
if (abs(p1[i]) == 1):
total_cross += num_cross
if (total_cross % 2):
sign = (- sign)
def key(X):
e = list(v)
for i in pairings:
if (i in X):
p[i] = 2
else:
p[i] = 0
e[i] = ((e[i] + k) % tk)
return (self._psi(p), tuple(e))
q = self._q
ret = {key(X): ((((- 1) ** len(X)) * sign) * (q ** (q_power + (k * (len(pairings) % 2))))) for X in powerset(pairings)}
return self._from_dict(ret)
class Element(QuantumCliffordAlgebra.Element):
def inverse(self):
'\n Return the inverse if ``self`` is a basis element.\n\n EXAMPLES::\n\n sage: Cl = algebras.QuantumClifford(3, 3, -1)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2\n sage: w0^-1\n w0^5\n sage: w0^-1 * w0\n 1\n sage: w0^-2\n w0^4\n sage: w0^-2 * w0^2\n 1\n sage: w0^-2 * w0 == w0^-1\n True\n sage: w = w0 * w1^3\n sage: w^-1\n w0^5*w1^3\n sage: w^-1 * w\n 1\n sage: w * w^-1\n 1\n\n sage: (2*w0)^-1\n 1/2*w0^5\n\n sage: Cl = algebras.QuantumClifford(3, 1, -1)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psi2, psid0, psid1, psid2, w0, w1, w2\n\n sage: (w0 + w1)^-1\n Traceback (most recent call last):\n ...\n ValueError: cannot invert self (= w1 + w0)\n sage: (psi0 * w0)^-1\n Traceback (most recent call last):\n ...\n ValueError: cannot invert self (= psi0*w0)\n\n sage: z = CyclotomicField(6).gen()\n sage: Cl = algebras.QuantumClifford(1, 3, z)\n sage: Cl.inject_variables()\n Defining psi0, psid0, w0\n sage: (psi0 + psid0).inverse()\n psid0*w0^3 - psi0*w0^3\n\n sage: Cl = algebras.QuantumClifford(2, 2, -1)\n sage: Cl.inject_variables()\n Defining psi0, psi1, psid0, psid1, w0, w1\n sage: w0^-1\n w0^3\n sage: w0 * w0^-1\n 1\n '
if (not self):
raise ZeroDivisionError
if (len(self) != 1):
return super().__invert__()
Cl = self.parent()
(((p, w), coeff),) = list(self._monomial_coefficients.items())
if any(((p[i] != 0) for i in range(Cl._n))):
return super().__invert__()
tk = (2 * Cl._k)
w = tuple([((tk - val) if val else 0) for val in w])
return Cl.element_class(Cl, {(p, w): coeff.inverse_of_unit()})
__invert__ = inverse
|
class ACEQuantumOnsagerAlgebra(CombinatorialFreeModule):
'\n The alternating central extension of the `q`-Onsager algebra.\n\n The *alternating central extension* `\\mathcal{A}_q` of the `q`-Onsager\n algebra `O_q` is a current algebra of `O_q` introduced by Baseilhac\n and Koizumi [BK2005]_. A presentation was given by Baseilhac\n and Shigechi [BS2010]_, which was then reformulated in terms of currents\n in [Ter2021]_ and then used to prove that the generators form a PBW basis.\n\n .. NOTE::\n\n This is only for the `q`-Onsager algebra with parameter\n `c = q^{-1} (q - q^{-1})^2`.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: AG = A.algebra_generators()\n\n We construct the generators `\\mathcal{G}_3`, `\\mathcal{W}_{-5}`,\n `\\mathcal{W}_2`, and `\\widetilde{\\mathcal{G}}_{4}` and perform\n some computations::\n\n sage: G3 = AG[0,3]\n sage: Wm5 = AG[1,-5]\n sage: W2 = AG[1,2]\n sage: Gt4 = AG[2,4]\n sage: [G3, Wm5, W2, Gt4]\n [G[3], W[-5], W[2], Gt[4]]\n sage: Gt4 * G3\n G[3]*Gt[4] + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-6]*W[1]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-5]*W[2]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[-4]*W[1]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-4]*W[3]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-3]*W[-2]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[-3]*W[2]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[-2]*W[5]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-1]*W[4]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[-1]*W[6]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[0]*W[5]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[0]*W[7]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[3]*W[4]\n sage: Wm5 * G3\n ((q^2-1)/q^2)*G[1]*W[-7] + ((-q^2+1)/q^2)*G[1]*W[7]\n + ((q^2-1)/q^2)*G[2]*W[-6] + ((-q^2+1)/q^2)*G[2]*W[6] + G[3]*W[-5]\n + ((-q^2+1)/q^2)*G[6]*W[-2] + ((q^2-1)/q^2)*G[6]*W[2]\n + ((-q^2+1)/q^2)*G[7]*W[-1] + ((q^2-1)/q^2)*G[7]*W[1]\n + ((-q^2+1)/q^2)*G[8]*W[0] + ((-q^8+2*q^4-1)/q^5)*W[-8]\n + ((q^8-2*q^4+1)/q^5)*W[8]\n sage: W2 * G3\n (q^2-1)*G[1]*W[-2] + (-q^2+1)*G[1]*W[4] + (-q^2+1)*G[3]*W[0]\n + q^2*G[3]*W[2] + (q^2-1)*G[4]*W[1] + ((-q^8+2*q^4-1)/q^3)*W[-3]\n + ((q^8-2*q^4+1)/q^3)*W[5]\n sage: W2 * Wm5\n (q^4/(q^8+2*q^6-2*q^2-1))*G[1]*Gt[6] + (-q^4/(q^8+2*q^6-2*q^2-1))*G[6]*Gt[1]\n + W[-5]*W[2] + (q/(q^2+1))*G[7] + (-q/(q^2+1))*Gt[7]\n sage: Gt4 * Wm5\n ((q^2-1)/q^2)*W[-8]*Gt[1] + ((q^2-1)/q^2)*W[-7]*Gt[2]\n + ((q^2-1)/q^2)*W[-6]*Gt[3] + W[-5]*Gt[4] + ((-q^2+1)/q^2)*W[-3]*Gt[6]\n + ((-q^2+1)/q^2)*W[-2]*Gt[7] + ((-q^2+1)/q^2)*W[-1]*Gt[8]\n + ((-q^2+1)/q^2)*W[0]*Gt[9] + ((q^2-1)/q^2)*W[1]*Gt[8]\n + ((q^2-1)/q^2)*W[2]*Gt[7] + ((q^2-1)/q^2)*W[3]*Gt[6]\n + ((-q^2+1)/q^2)*W[6]*Gt[3] + ((-q^2+1)/q^2)*W[7]*Gt[2]\n + ((-q^2+1)/q^2)*W[8]*Gt[1] + ((-q^8+2*q^4-1)/q^5)*W[-9]\n + ((q^8-2*q^4+1)/q^5)*W[9]\n sage: Gt4 * W2\n (q^2-1)*W[-3]*Gt[1] + (-q^2+1)*W[0]*Gt[4] + (q^2-1)*W[1]*Gt[5]\n + q^2*W[2]*Gt[4] + (-q^2+1)*W[5]*Gt[1] + ((-q^8+2*q^4-1)/q^3)*W[-4]\n + ((q^8-2*q^4+1)/q^3)*W[6]\n\n REFERENCES:\n\n - [BK2005]_\n - [BS2010]_\n - [Ter2021]_\n '
@staticmethod
def __classcall_private__(cls, R=None, q=None):
'\n Normalize input to ensure a unique representation.\n\n TESTS::\n\n sage: A1 = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: R.<q> = QQ[]\n sage: q = R.gen()\n sage: A2 = algebras.AlternatingCentralExtensionQuantumOnsager(R.fraction_field(), q)\n sage: A1 is A2\n True\n sage: A2.q().parent() is R.fraction_field()\n True\n sage: q = R.fraction_field().gen()\n sage: A3 = algebras.AlternatingCentralExtensionQuantumOnsager(q=q)\n sage: A1 is A3\n True\n '
if (q is None):
if (R is None):
raise ValueError('either base ring or q must be specified')
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
q = PolynomialRing(R, 'q').fraction_field().gen()
R = q.parent()
elif (R is None):
R = q.parent()
else:
q = R(q)
return super().__classcall__(cls, R, q)
def __init__(self, R, q):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: TestSuite(A).run() # long time\n '
I = DisjointUnionEnumeratedSets([PositiveIntegers(), ZZ, PositiveIntegers()], keepkey=True, facade=True)
monomials = IndexedFreeAbelianMonoid(I, prefix='A', bracket=False)
self._q = q
CombinatorialFreeModule.__init__(self, R, monomials, prefix='', bracket=False, latex_bracket=False, sorting_key=self._monomial_key, category=Algebras(R).WithBasis().Filtered())
def _monomial_key(self, x):
'\n Compute the key for ``x`` so that the comparison is done by\n reverse degree lexicographic order.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: AG = A.algebra_generators()\n sage: AG[1,1] * AG[1,0] * AG[0,1] # indirect doctest\n G[1]*W[0]*W[1] + (q/(q^2+1))*G[1]^2 + (-q/(q^2+1))*G[1]*Gt[1]\n + ((-q^8+2*q^4-1)/q^5)*W[-1]*W[1] + ((-q^8+2*q^4-1)/q^5)*W[0]^2\n + ((q^8-2*q^4+1)/q^5)*W[0]*W[2] + ((q^8-2*q^4+1)/q^5)*W[1]^2\n '
return ((- len(x)), x.to_word_list())
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A\n Alternating Central Extension of q-Onsager algebra over Fraction\n Field of Univariate Polynomial Ring in q over Rational Field\n '
return 'Alternating Central Extension of {}-Onsager algebra over {}'.format(self._q, self.base_ring())
def _latex_(self):
'\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: latex(A)\n \\mathcal{A}_{q,\\mathrm{Frac}(\\Bold{Q}[q])}\n '
from sage.misc.latex import latex
return '\\mathcal{{A}}_{{{},{}}}'.format(latex(self._q), latex(self.base_ring()))
def _repr_term(self, m):
"\n Return a string representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: I = A._indices.gens()\n sage: A._repr_term(I[0,3])\n 'G[3]'\n sage: A._repr_term(I[1,-2])\n 'W[-2]'\n sage: A._repr_term(I[1,3])\n 'W[3]'\n sage: A._repr_term(I[2,5])\n 'Gt[5]'\n sage: A._repr_term(I[0,1]^2 * I[1,0] * I[1,3]^13 * I[2,3])\n 'G[1]^2*W[0]*W[3]^13*Gt[3]'\n "
def to_str(x):
(k, e) = x
if (k[0] == 0):
ret = 'G[{}]'.format(k[1])
elif (k[0] == 1):
ret = 'W[{}]'.format(k[1])
elif (k[0] == 2):
ret = 'Gt[{}]'.format(k[1])
if (e > 1):
ret = (ret + '^{}'.format(e))
return ret
return '*'.join((to_str(x) for x in m._sorted_items()))
def _latex_term(self, m):
"\n Return a latex representation of the term indexed by ``m``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: I = A._indices.gens()\n sage: A._latex_term(I[0,3])\n '\\\\mathcal{G}_{3}'\n sage: A._latex_term(I[1,-2])\n '\\\\mathcal{W}_{-2}'\n sage: A._latex_term(I[1,3])\n '\\\\mathcal{W}_{3}'\n sage: A._latex_term(I[2,5])\n '\\\\widetilde{\\\\mathcal{G}}_{5}'\n sage: A._latex_term(I[0,1]^2 * I[1,0] * I[1,3]^13 * I[2,3])\n '\\\\mathcal{G}_{1}^{2} \\\\mathcal{W}_{0} \\\\mathcal{W}_{3}^{13} \\\\widetilde{\\\\mathcal{G}}_{3}'\n "
def to_str(x):
(k, e) = x
if (k[0] == 0):
ret = '\\mathcal{{G}}_{{{}}}'.format(k[1])
elif (k[0] == 1):
ret = '\\mathcal{{W}}_{{{}}}'.format(k[1])
elif (k[0] == 2):
ret = '\\widetilde{{\\mathcal{{G}}}}_{{{}}}'.format(k[1])
if (e > 1):
ret = (ret + '^{{{}}}'.format(e))
return ret
return ' '.join((to_str(x) for x in m._sorted_items()))
@cached_method
def algebra_generators(self):
'\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A.algebra_generators()\n Lazy family (generator map(i))_{i in Disjoint union of\n Family (Positive integers, Integer Ring, Positive integers)}\n '
G = self._indices.gens()
q = self._q
def monomial_map(x):
if ((x[0] != 1) and (x[1] == 0)):
return self.term(self.one_basis(), ((- (q - (~ q))) * ((q + (~ q)) ** 2)))
return self.monomial(G[x])
return Family(self._indices._indices, monomial_map, name='generator map')
gens = algebra_generators
def q(self):
'\n Return the parameter `q` of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A.q()\n q\n '
return self._q
@cached_method
def one_basis(self):
'\n Return the basis element indexing `1`.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: ob = A.one_basis(); ob\n 1\n sage: ob.parent()\n Free abelian monoid indexed by Disjoint union of\n Family (Positive integers, Integer Ring, Positive integers)\n '
return self._indices.one()
def _an_element_(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A.an_element()\n q*G[2] - 2*W[-3] + W[2] - q*Gt[1]\n '
G = self.algebra_generators()
return ((G[(1, 2)] - (2 * G[(1, (- 3))])) + (self.base_ring().an_element() * (G[(0, 2)] - G[(2, 1)])))
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A.some_elements()\n [W[0], W[3], W[-1], W[1], W[-2], G[1], G[2], Gt[1], Gt[2]]\n '
G = self.algebra_generators()
return [G[(1, 0)], G[(1, 3)], G[(1, (- 1))], G[(1, 1)], G[(1, (- 2))], G[(0, 1)], G[(0, 2)], G[(2, 1)], G[(2, 2)]]
def degree_on_basis(self, m):
'\n Return the degree of the basis element indexed by ``m``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: G = A.algebra_generators()\n sage: A.degree_on_basis(G[0,1].leading_support())\n 2\n sage: A.degree_on_basis(G[0,2].leading_support())\n 4\n sage: A.degree_on_basis(G[1,-1].leading_support())\n 3\n sage: A.degree_on_basis(G[1,0].leading_support())\n 1\n sage: A.degree_on_basis(G[1,1].leading_support())\n 1\n sage: A.degree_on_basis(G[2,1].leading_support())\n 2\n sage: A.degree_on_basis(G[2,2].leading_support())\n 4\n sage: [x.degree() for x in A.some_elements()]\n [1, 5, 3, 1, 5, 2, 4, 2, 4]\n '
def deg(k):
if (k[0] != 1):
return (2 * k[1])
return ((((- 2) * k[1]) + 1) if (k[1] <= 0) else ((2 * k[1]) - 1))
return ZZ.sum(((deg(k) * c) for (k, c) in m._monomial.items()))
@cached_method
def quantum_onsager_pbw_generator(self, i):
'\n Return the image of the PBW generator of the `q`-Onsager algebra\n in ``self``.\n\n INPUT:\n\n - ``i`` -- a pair ``(k, m)`` such that\n\n * ``k=0`` and ``m`` is an integer\n * ``k=1`` and ``m`` is a positive integer\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: A.quantum_onsager_pbw_generator((0,0))\n W[1]\n sage: A.quantum_onsager_pbw_generator((0,1))\n (q^3/(q^4-1))*W[1]*Gt[1] - q^2*W[0] + (q^2+1)*W[2]\n sage: A.quantum_onsager_pbw_generator((0,2))\n (q^6/(q^8-2*q^4+1))*W[1]*Gt[1]^2 + (-q^5/(q^4-1))*W[0]*Gt[1]\n + (q^3/(q^2-1))*W[1]*Gt[2] + (q^3/(q^2-1))*W[2]*Gt[1]\n + (-q^4-q^2)*W[-1] - q^2*W[1] + (q^4+2*q^2+1)*W[3]\n sage: A.quantum_onsager_pbw_generator((0,-1))\n W[0]\n sage: A.quantum_onsager_pbw_generator((0,-2))\n (q/(q^4-1))*W[0]*Gt[1] + ((q^2+1)/q^2)*W[-1] - 1/q^2*W[1]\n sage: A.quantum_onsager_pbw_generator((0,-3))\n (q^2/(q^8-2*q^4+1))*W[0]*Gt[1]^2 + (1/(q^3-q))*W[-1]*Gt[1]\n + (1/(q^3-q))*W[0]*Gt[2] - (1/(q^5-q))*W[1]*Gt[1]\n + ((q^4+2*q^2+1)/q^4)*W[-2] - 1/q^2*W[0] + ((-q^2-1)/q^4)*W[2]\n sage: A.quantum_onsager_pbw_generator((1,1))\n ((-q^2+1)/q^2)*W[0]*W[1] + (1/(q^3+q))*G[1] - (1/(q^3+q))*Gt[1]\n sage: A.quantum_onsager_pbw_generator((1,2))\n -1/q*W[0]*W[1]*Gt[1] + (1/(q^6+q^4-q^2-1))*G[1]*Gt[1]\n + ((-q^4+1)/q^4)*W[-1]*W[1] + (q^2-1)*W[0]^2\n + ((-q^4+1)/q^2)*W[0]*W[2] + ((q^2-1)/q^4)*W[1]^2\n - (1/(q^6+q^4-q^2-1))*Gt[1]^2 + 1/q^3*G[2] - 1/q^3*Gt[2]\n '
W0 = self.algebra_generators()[(1, 0)]
W1 = self.algebra_generators()[(1, 1)]
q = self._q
if (i[0] == 0):
if (i[1] < 0):
if (i[1] == (- 1)):
return W0
Bd = self.quantum_onsager_pbw_generator((1, 1))
Bm1 = self.quantum_onsager_pbw_generator((0, (i[1] + 1)))
Bm2 = self.quantum_onsager_pbw_generator((0, (i[1] + 2)))
return (Bm2 + ((q / ((((q ** (- 3)) - (~ q)) - q) + (q ** 3))) * ((Bd * Bm1) - (Bm1 * Bd))))
else:
if (i[1] == 0):
return W1
Bd = self.quantum_onsager_pbw_generator((1, 1))
Bm1 = self.quantum_onsager_pbw_generator((0, (i[1] - 1)))
Bm2 = self.quantum_onsager_pbw_generator((0, (i[1] - 2)))
return (Bm2 - ((q / ((((q ** (- 3)) - (~ q)) - q) + (q ** 3))) * ((Bd * Bm1) - (Bm1 * Bd))))
elif (i[0] == 1):
if (i[1] == 1):
return ((((q ** (- 2)) * W1) * W0) - (W0 * W1))
if (i[1] <= 0):
raise ValueError('not an index of a PBW basis element')
B = self.quantum_onsager_pbw_generator
n = i[1]
Bm1 = self.quantum_onsager_pbw_generator((0, (n - 1)))
return (((((q ** (- 2)) * Bm1) * W0) - (W0 * Bm1)) + (((q ** (- 2)) - 1) * sum(((B((0, ell)) * B((0, ((n - ell) - 2)))) for ell in range((n - 1))))))
raise ValueError('not an index of a PBW basis element')
@cached_method
def product_on_basis(self, lhs, rhs):
'\n Return the product of the two basis elements ``lhs`` and ``rhs``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: G = A.algebra_generators()\n sage: q = A.q()\n sage: rho = -(q^2 - q^-2)^2\n\n We verify the PBW ordering::\n\n sage: G[0,1] * G[1,1] # indirect doctest\n G[1]*W[1]\n sage: G[1,1] * G[0,1]\n q^2*G[1]*W[1] + ((-q^8+2*q^4-1)/q^3)*W[0] + ((q^8-2*q^4+1)/q^3)*W[2]\n sage: G[1,-1] * G[1,1]\n W[-1]*W[1]\n sage: G[1,1] * G[1,-1]\n W[-1]*W[1] + (q/(q^2+1))*G[2] + (-q/(q^2+1))*Gt[2]\n sage: G[1,1] * G[2,1]\n W[1]*Gt[1]\n sage: G[2,1] * G[1,1]\n q^2*W[1]*Gt[1] + ((-q^8+2*q^4-1)/q^3)*W[0] + ((q^8-2*q^4+1)/q^3)*W[2]\n sage: G[0,1] * G[2,1]\n G[1]*Gt[1]\n sage: G[2,1] * G[0,1]\n G[1]*Gt[1] + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-1]*W[1]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[0]^2\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[0]*W[2]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[1]^2\n\n We verify some of the defining relations (see Equations (3-14)\n in [Ter2021]_), which are used to construct the PBW basis::\n\n sage: G[0,1] * G[0,2] == G[0,2] * G[0,1]\n True\n sage: G[1,-1] * G[1,-2] == G[1,-2] * G[1,-1]\n True\n sage: G[1,1] * G[1,2] == G[1,2] * G[1,1]\n True\n sage: G[2,1] * G[2,2] == G[2,2] * G[2,1]\n True\n sage: G[1,0] * G[1,2] - G[1,2] * G[1,0] == G[1,-1] * G[1,1] - G[1,1] * G[1,-1]\n True\n sage: G[1,0] * G[1,2] - G[1,2] * G[1,0] == (G[2,2] - G[0,2]) / (q + ~q)\n True\n sage: q * G[1,0] * G[0,2] - ~q * G[0,2] * G[1,0] == q * G[2,2] * G[1,0] - ~q * G[1,0] * G[2,2]\n True\n sage: q * G[1,0] * G[0,2] - ~q * G[0,2] * G[1,0] == rho * G[1,-2] - rho * G[1,2]\n True\n sage: q * G[0,2] * G[1,1] - ~q * G[1,1] * G[0,2] == q * G[1,1] * G[2,2] - ~q * G[2,2] * G[1,1]\n True\n sage: q * G[0,2] * G[1,1] - ~q * G[1,1] * G[0,2] == rho * G[1,3] - rho * G[1,-1]\n True\n sage: G[1,-2] * G[1,2] - G[1,2] * G[1,-2] == G[1,-1] * G[1,3] - G[1,3] * G[1,-1]\n True\n sage: G[1,-2] * G[0,2] - G[0,2] * G[1,-2] == G[1,-1] * G[0,3] - G[0,3] * G[1,-1]\n True\n sage: G[1,1] * G[0,2] - G[0,2] * G[1,1] == G[1,2] * G[0,1] - G[0,1] * G[1,2]\n True\n sage: G[1,-2] * G[2,2] - G[2,2] * G[1,-2] == G[1,-1] * G[2,3] - G[2,3] * G[1,-1]\n True\n sage: G[1,1] * G[2,2] - G[2,2] * G[1,1] == G[1,2] * G[2,1] - G[2,1] * G[1,2]\n True\n sage: G[0,1] * G[2,2] - G[2,2] * G[0,1] == G[0,2] * G[2,1] - G[2,1] * G[0,2]\n True\n '
if (lhs == self.one_basis()):
return self.monomial(rhs)
if (rhs == self.one_basis()):
return self.monomial(lhs)
I = self._indices
B = I.gens()
q = self._q
kl = lhs.trailing_support()
kr = rhs.leading_support()
if (kl <= kr):
return self.monomial((lhs * rhs))
A = self.algebra_generators()
if (kl[0] == kr[0]):
if ((kl[0] != 1) or ((kl[1] > 0) and (kr[1] > 0)) or ((kl[1] <= 0) and (kr[1] <= 0))):
return (self.monomial((lhs * B[kr])) * self.monomial((rhs // B[kr])))
i = (kl[1] - 1)
j = (- kr[1])
denom = (((q ** 2) - (q ** (- 2))) * ((q + (q ** (- 1))) ** 2))
terms = ((A[(1, (- j))] * A[(1, (i + 1))]) + (self.sum((((A[(0, ell)] * A[(2, (((i + j) + 1) - ell))]) - (A[(0, (((i + j) + 1) - ell))] * A[(2, ell)])) for ell in range((min(i, j) + 1)))) / denom))
elif ((kl[0] == 2) and (kr[0] == 0)):
i = (kl[1] - 1)
j = (kr[1] - 1)
coeff = (((q ** 2) - (q ** (- 2))) ** 3)
terms = (((((A[(0, (j + 1))] * A[(2, (i + 1))]) - ((coeff * A[(1, (- i))]) * A[(1, (- j))])) + ((coeff * A[(1, (i + 1))]) * A[(1, (j + 1))])) + (coeff * sum((((A[(1, (- ell))] * A[(1, (((i + j) + 2) - ell))]) - (A[(1, (((ell - 1) - i) - j))] * A[(1, (ell + 1))])) for ell in range((min(i, j) + 1)))))) - (coeff * sum((((A[(1, (1 - ell))] * A[(1, (((i + j) + 1) - ell))]) - (A[(1, ((ell - i) - j))] * A[(1, ell)])) for ell in range(1, (min(i, j) + 1))))))
elif ((kl[0] == 1) and (kr[0] == 0)):
if (kl[1] > 0):
i = (kl[1] - 1)
j = (kr[1] - 1)
coeff = (q * (q - (~ q)))
terms = ((((A[(0, (j + 1))] * A[(1, (i + 1))]) + (coeff * sum(((A[(0, ell)] * A[(1, ((ell - i) - j))]) for ell in range((min(i, j) + 1)))))) + (coeff * sum((((A[(0, (((i + j) + 1) - ell))] * A[(1, (ell + 1))]) - (A[(0, ell)] * A[(1, (((i + j) + 2) - ell))])) for ell in range((min(i, j) + 1)))))) - (coeff * sum(((A[(0, (((i + j) + 1) - ell))] * A[(1, (1 - ell))]) for ell in range(1, (min(i, j) + 1))))))
else:
i = (- kl[1])
j = (kr[1] - 1)
coeff = ((~ q) * (q - (~ q)))
terms = ((((A[(0, (j + 1))] * A[(1, (- i))]) - (coeff * sum(((A[(0, ell)] * A[(1, (((i + j) + 1) - ell))]) for ell in range((min(i, j) + 1)))))) + (coeff * sum((((A[(0, ell)] * A[(1, (((ell - 1) - i) - j))]) - (A[(0, (((i + j) + 1) - ell))] * A[(1, (- ell))])) for ell in range((min(i, j) + 1)))))) + (coeff * sum(((A[(0, (((i + j) + 1) - ell))] * A[(1, ell)]) for ell in range(1, (min(i, j) + 1))))))
elif ((kl[0] == 2) and (kr[0] == 1)):
if (kr[1] > 0):
i = (kl[1] - 1)
j = (kr[1] - 1)
coeff = (q * (q - (~ q)))
terms = ((((A[(1, (j + 1))] * A[(2, (i + 1))]) + (coeff * sum(((A[(1, ((ell - i) - j))] * A[(2, ell)]) for ell in range((min(i, j) + 1)))))) + (coeff * sum((((A[(1, (ell + 1))] * A[(2, (((i + j) + 1) - ell))]) - (A[(1, (((i + j) + 2) - ell))] * A[(2, ell)])) for ell in range((min(i, j) + 1)))))) - (coeff * sum(((A[(1, (1 - ell))] * A[(2, (((i + j) + 1) - ell))]) for ell in range(1, (min(i, j) + 1))))))
else:
i = (kl[1] - 1)
j = (- kr[1])
coeff = ((~ q) * (q - (~ q)))
terms = ((((A[(1, (- j))] * A[(2, (i + 1))]) - (coeff * sum(((A[(1, (((i + j) + 1) - ell))] * A[(2, ell)]) for ell in range((min(i, j) + 1)))))) + (coeff * sum((((A[(1, (((ell - 1) - i) - j))] * A[(2, ell)]) - (A[(1, (- ell))] * A[(2, (((i + j) + 1) - ell))])) for ell in range((min(i, j) + 1)))))) + (coeff * sum(((A[(1, ell)] * A[(2, (((i + j) + 1) - ell))]) for ell in range(1, (min(i, j) + 1))))))
return ((self.monomial((lhs // B[kl])) * terms) * self.monomial((rhs // B[kr])))
def _sigma_on_basis(self, x):
'\n Return the action of the `\\sigma` automorphism on the basis element\n indexed by ``x``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: I = A._indices.monoid_generators()\n sage: A._sigma_on_basis(I[1,-1] * I[1,1])\n W[0]*W[2] + (q/(q^2+1))*G[2] + (-q/(q^2+1))*Gt[2]\n sage: A._sigma_on_basis(I[0,1] * I[2,1])\n G[1]*Gt[1] + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[-1]*W[1]\n + ((-q^12+3*q^8-3*q^4+1)/q^6)*W[0]^2\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[0]*W[2]\n + ((q^12-3*q^8+3*q^4-1)/q^6)*W[1]^2\n sage: [(x, A.sigma(x)) for x in A.some_elements()]\n [(W[0], W[1]), (W[3], W[-2]), (W[-1], W[2]), (W[1], W[0]),\n (W[-2], W[3]), (G[1], Gt[1]), (G[2], Gt[2]), (Gt[1], G[1]),\n (Gt[2], G[2])]\n '
def tw(m):
if (m[0] == 0):
return (2, m[1])
if (m[0] == 1):
return (1, ((- m[1]) + 1))
if (m[0] == 2):
return (0, m[1])
A = self.algebra_generators()
return self.prod(((A[tw(m)] ** e) for (m, e) in x._sorted_items()))
def _dagger_on_basis(self, x):
'\n Return the action of the `\\dagger` antiautomorphism on the basis element\n indexed by ``x``.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: I = A._indices.monoid_generators()\n sage: A._dagger_on_basis(I[0,1] * I[1,-1] * I[2,1])\n G[1]*W[-1]*Gt[1]\n sage: A._dagger_on_basis(I[1,-1] * I[1,1])\n W[-1]*W[1] + (q/(q^2+1))*G[2] + (-q/(q^2+1))*Gt[2]\n sage: A._dagger_on_basis(I[0,1] * I[1,-1] * I[1,2] * I[2,1])\n (q^4/(q^8+2*q^6-2*q^2-1))*G[1]^2*Gt[1]*Gt[2]\n + (-q^4/(q^8+2*q^6-2*q^2-1))*G[1]*G[2]*Gt[1]^2\n + G[1]*W[-1]*W[2]*Gt[1] + (q/(q^2+1))*G[1]*G[3]*Gt[1]\n + (-q/(q^2+1))*G[1]*Gt[1]*Gt[3]\n sage: [(x, A.dagger(x)) for x in A.some_elements()]\n [(W[0], W[0]), (W[3], W[3]), (W[-1], W[-1]), (W[1], W[1]),\n (W[-2], W[-2]), (G[1], Gt[1]), (G[2], Gt[2]), (Gt[1], G[1]),\n (Gt[2], G[2])]\n '
def tw(m):
if (m[0] == 0):
return (2, m[1])
if (m[0] == 1):
return (1, m[1])
if (m[0] == 2):
return (0, m[1])
A = self.algebra_generators()
return self.prod(((A[tw(m)] ** e) for (m, e) in reversed(x._sorted_items())))
@lazy_attribute
def sigma(self):
'\n The automorphism `\\sigma`.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: G = A.algebra_generators()\n sage: x = A.an_element()^2\n sage: A.sigma(A.sigma(x)) == x\n True\n sage: A.sigma(G[1,-1] * G[1,1]) == A.sigma(G[1,-1]) * A.sigma(G[1,1])\n True\n sage: A.sigma(G[0,2] * G[1,3]) == A.sigma(G[0,2]) * A.sigma(G[1,3])\n True\n '
return self.module_morphism(self._sigma_on_basis, codomain=self, category=self.category())
@lazy_attribute
def dagger(self):
'\n The antiautomorphism `\\dagger`.\n\n EXAMPLES::\n\n sage: A = algebras.AlternatingCentralExtensionQuantumOnsager(QQ)\n sage: G = A.algebra_generators()\n sage: x = A.an_element()^2\n sage: A.dagger(A.dagger(x)) == x\n True\n sage: A.dagger(G[1,-1] * G[1,1]) == A.dagger(G[1,1]) * A.dagger(G[1,-1])\n True\n sage: A.dagger(G[0,2] * G[1,3]) == A.dagger(G[1,3]) * A.dagger(G[0,2])\n True\n sage: A.dagger(G[2,2] * G[1,3]) == A.dagger(G[1,3]) * A.dagger(G[2,2])\n True\n '
return self.module_morphism(self._dagger_on_basis, codomain=self)
|
class FockSpaceOptions(GlobalOptions):
"\n Sets and displays the global options for elements of the Fock\n space classes. If no parameters are set, then the function\n returns a copy of the options dictionary.\n\n The ``options`` to Fock space can be accessed as the method\n :obj:`FockSpaceOptions` of :class:`FockSpace` and\n related parent classes.\n\n @OPTIONS@\n\n EXAMPLES::\n\n sage: FS = FockSpace(4)\n sage: F = FS.natural()\n sage: x = F.an_element()\n sage: y = x.f(3,2,2,0,1)\n sage: y\n ((3*q^2+3)/q)*|3, 3, 1> + (3*q^2+3)*|3, 2, 1, 1>\n sage: Partitions.options.display = 'diagram'\n sage: y\n ((3*q^2+3)/q)*|3, 3, 1> + (3*q^2+3)*|3, 2, 1, 1>\n sage: ascii_art(y)\n ((3*q^2+3)/q)*|***\\ + (3*q^2+3)*|***\\\n |*** > |** \\\n |* / |* /\n |* /\n sage: FockSpace.options.display = 'list'\n sage: ascii_art(y)\n ((3*q^2+3)/q)*F + (3*q^2+3)*F\n *** ***\n *** **\n * *\n *\n sage: Partitions.options.display = 'compact_high'\n sage: y\n ((3*q^2+3)/q)*F3^2,1 + (3*q^2+3)*F3,2,1^2\n\n sage: Partitions.options._reset()\n sage: FockSpace.options._reset()\n "
NAME = 'FockSpace'
module = 'sage.algebras.quantum_groups.fock_space'
display = {'default': 'ket', 'description': 'Specifies how terms of the natural basis of Fock space should be printed', 'values': {'ket': 'displayed as a ket in bra-ket notation', 'list': 'displayed as a list'}, 'case_sensitive': False}
|
class FockSpace(Parent, UniqueRepresentation):
'\n The (fermionic) Fock space of `U_q(\\widehat{\\mathfrak{sl}}_n)` with\n multicharge `(\\gamma_1, \\ldots, \\gamma_m)`.\n\n Fix a positive integer `n > 1` and fix a sequence\n `\\gamma = (\\gamma_1, \\ldots, \\gamma_m)`, where `\\gamma_i \\in \\ZZ / n \\ZZ`.\n *(fermionic) Fock space* `\\mathcal{F}` with multicharge `\\gamma` is a\n `U_q(\\widehat{\\mathfrak{gl}}_n)`-representation with a basis\n `\\{ |\\lambda \\rangle \\}`, where `\\lambda` is a partition tuple of\n level `m`. By considering `\\mathcal{F}` as a\n `U_q(\\widehat{\\mathfrak{sl}}_n)`-representation,\n it is not irreducible, but the submodule generated by\n `| \\emptyset^m \\rangle` is isomorphic to the highest weight module\n `V(\\mu)`, where the highest weight `\\mu = \\sum_i \\Lambda_{\\gamma_i}`.\n\n Let `R_i(\\lambda)` and `A_i(\\lambda)` be the set of removable and\n addable, respectively, `i`-cells of `\\lambda`, where an `i`-cell is\n a cell of residue `i` (i.e., content modulo n).\n The action of `U_q(\\widehat{\\mathfrak{sl}}_n)` is given as follows:\n\n .. MATH::\n\n \\begin{aligned}\n e_i | \\lambda \\rangle & = \\sum_{c \\in R_i(\\lambda)}\n q^{M_i(\\lambda, c)} | \\lambda + c \\rangle, \\\\\n f_i | \\lambda \\rangle & = \\sum_{c \\in A_i(\\lambda)}\n q^{N_i(\\lambda, c)} | \\lambda - c \\rangle, \\\\\n q^{h_i} | \\lambda \\rangle & = q^{N_i(\\lambda)} | \\lambda \\rangle, \\\\\n q^d | \\lambda \\rangle & = q^{-N^{(0)}(\\lambda)} | \\lambda \\rangle,\n \\end{aligned}\n\n where\n\n - `M_i(\\lambda, c)` (resp. `N_i(\\lambda, c)`) is the number of removable\n (resp. addable) `i`-cells of `\\lambda` below (resp. above) `c` minus\n the number of addable (resp. removable) `i`-cells of `\\lambda` below\n (resp. above) `c`,\n - `N_i(\\lambda)` is the number of addable `i`-cells minus the number of\n removable `i`-cells, and\n - `N^{(0)}(\\lambda)` is the total number of `0`-cells of `\\lambda`.\n\n Another interpretation of Fock space is as a semi-infinite wedge\n product (which each factor we can think of as fermions). This allows\n a description of the `U_q(\\widehat{\\mathfrak{gl}}_n)` action, as well\n as an explicit description of the bar involution. In particular, the\n bar involution is the unique semi-linear map satisfying\n\n - `q \\mapsto q^{-1}`,\n - `\\overline{| \\emptyset \\rangle} = | \\emptyset \\rangle`, and\n - `\\overline{f_i | \\lambda \\rangle} = f_i \\overline{| \\lambda \\rangle}`.\n\n We then define the *canonical basis* or *(lower) global crystal basis*\n as the unique basis of `\\mathcal{F}` such that\n\n - `\\overline{G(\\lambda)} = G(\\lambda)`,\n - `G(\\lambda) \\equiv | \\lambda \\rangle \\mod q \\ZZ[q]`.\n\n It is also known that this basis is upper unitriangular with respect to\n dominance order and that both the natural basis and the canonical basis\n of `\\mathcal{F}` are `\\ZZ`-graded by `|\\lambda|`. Additionally, the\n transition matrices `(d_{\\lambda, \\nu})_{\\lambda,\\nu \\vdash n}` given by\n\n .. MATH::\n\n G(\\nu) = \\sum_{\\lambda \\vdash |\\nu|} d_{\\lambda,\\nu} |\\lambda \\rangle\n\n described the decomposition matrices of the Hecke algebras when\n restricting to `V(\\mu)` [Ariki1996]_.\n\n To go between the canonical basis and the natural basis, for level 1\n Fock space, we follow the LLT algorithm [LLT1996]_. Indeed, we first\n construct a basis `\\{ A(\\nu) \\}` that is an approximation to the\n lower global crystal basis, in the sense that it is bar-invariant,\n and then use Gaussian elimination to construct the lower global\n crystal basis. For higher level Fock space, we follow [Fayers2010]_,\n where the higher level is considered as a tensor product space\n of the corresponding level 1 Fock spaces.\n\n There are three bases currently implemented:\n\n - The natural basis:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.F`.\n - The approximation basis that comes from LLT(-type) algorithms:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.A`.\n - The lower global crystal basis:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.G`.\n\n .. TODO::\n\n - Implement the approximation and lower global crystal bases on\n all partition tuples.\n - Implement the bar involution.\n - Implement the full `U_q(\\widehat{\\mathfrak{gl}})`-action.\n\n INPUT:\n\n - ``n`` -- the value `n`\n - ``multicharge`` -- (default: ``[0]``) the multicharge\n - ``q`` -- (optional) the parameter `q`\n - ``base_ring`` -- (optional) the base ring containing ``q``\n\n EXAMPLES:\n\n We start by constructing the natural basis and doing\n some computations::\n\n sage: Fock = FockSpace(3)\n sage: F = Fock.natural()\n sage: u = F.highest_weight_vector()\n sage: u.f(0,2,(1,2),0)\n |2, 2, 1> + q*|2, 1, 1, 1>\n sage: u.f(0,2,(1,2),0,2)\n |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>\n sage: x = u.f(0,2,(1,2),0,2)\n sage: [x.h(i) for i in range(3)]\n [q*|3, 2, 1> + q^2*|3, 1, 1, 1> + q^2*|2, 2, 2> + q^3*|2, 1, 1, 1, 1>,\n |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>,\n |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>]\n sage: [x.h_inverse(i) for i in range(3)]\n [1/q*|3, 2, 1> + |3, 1, 1, 1> + |2, 2, 2> + q*|2, 1, 1, 1, 1>,\n |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>,\n |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>]\n sage: x.d()\n 1/q^2*|3, 2, 1> + 1/q*|3, 1, 1, 1> + 1/q*|2, 2, 2> + |2, 1, 1, 1, 1>\n\n Next, we construct the approximation and lower global crystal bases\n and convert to the natural basis::\n\n sage: A = Fock.A()\n sage: G = Fock.G()\n sage: F(A[4,2,2,1])\n |4, 2, 2, 1> + q*|4, 2, 1, 1, 1>\n sage: F(G[4,2,2,1])\n |4, 2, 2, 1> + q*|4, 2, 1, 1, 1>\n sage: F(A[7,3,2,1,1])\n |7, 3, 2, 1, 1> + q*|7, 2, 2, 2, 1> + q^2*|7, 2, 2, 1, 1, 1>\n + q*|6, 3, 3, 1, 1> + q^2*|6, 2, 2, 2, 2> + q^3*|6, 2, 2, 1, 1, 1, 1>\n + q*|5, 5, 2, 1, 1> + q^2*|5, 4, 3, 1, 1> + (q^2+1)*|4, 4, 3, 2, 1>\n + (q^3+q)*|4, 4, 3, 1, 1, 1> + (q^3+q)*|4, 4, 2, 2, 2>\n + (q^4+q^2)*|4, 4, 2, 1, 1, 1, 1> + q*|4, 3, 3, 3, 1>\n + q^2*|4, 3, 2, 1, 1, 1, 1, 1> + q^2*|4, 2, 2, 2, 2, 2>\n + q^3*|4, 2, 2, 2, 1, 1, 1, 1> + q^2*|3, 3, 3, 3, 2>\n + q^3*|3, 3, 3, 1, 1, 1, 1, 1> + q^3*|3, 2, 2, 2, 2, 2, 1>\n + q^4*|3, 2, 2, 2, 2, 1, 1, 1>\n sage: F(G[7,3,2,1,1])\n |7, 3, 2, 1, 1> + q*|7, 2, 2, 2, 1> + q^2*|7, 2, 2, 1, 1, 1>\n + q*|6, 3, 3, 1, 1> + q^2*|6, 2, 2, 2, 2>\n + q^3*|6, 2, 2, 1, 1, 1, 1> + q*|5, 5, 2, 1, 1>\n + q^2*|5, 4, 3, 1, 1> + q^2*|4, 4, 3, 2, 1>\n + q^3*|4, 4, 3, 1, 1, 1> + q^3*|4, 4, 2, 2, 2>\n + q^4*|4, 4, 2, 1, 1, 1, 1>\n sage: A(F(G[7,3,2,1,1]))\n A[7, 3, 2, 1, 1] - A[4, 4, 3, 2, 1]\n sage: G(F(A[7,3,2,1,1]))\n G[7, 3, 2, 1, 1] + G[4, 4, 3, 2, 1]\n sage: A(F(G[8,4,3,2,2,1]))\n A[8, 4, 3, 2, 2, 1] - A[6, 4, 4, 2, 2, 1, 1] - A[5, 5, 4, 3, 2, 1]\n + ((-q^2-1)/q)*A[5, 4, 4, 3, 2, 1, 1]\n sage: G(F(A[8,4,3,2,2,1]))\n G[8, 4, 3, 2, 2, 1] + G[6, 4, 4, 2, 2, 1, 1] + G[5, 5, 4, 3, 2, 1]\n + ((q^2+1)/q)*G[5, 4, 4, 3, 2, 1, 1]\n\n We can also construct higher level Fock spaces and perform\n similar computations::\n\n sage: Fock = FockSpace(3, [1,0])\n sage: F = Fock.natural()\n sage: A = Fock.A()\n sage: G = Fock.G()\n sage: F(G[[2,1],[4,1,1]])\n |[2, 1], [4, 1, 1]> + q*|[2, 1], [3, 2, 1]>\n + q^2*|[2, 1], [3, 1, 1, 1]> + q^2*|[2], [4, 2, 1]>\n + q^3*|[2], [4, 1, 1, 1]> + q^4*|[2], [3, 2, 1, 1]>\n + q*|[1, 1, 1], [4, 1, 1]> + q^2*|[1, 1, 1], [3, 2, 1]>\n + q^3*|[1, 1, 1], [3, 1, 1, 1]> + q^2*|[1, 1], [3, 2, 2]>\n + q^3*|[1, 1], [3, 1, 1, 1, 1]> + q^3*|[1], [4, 2, 2]>\n + q^4*|[1], [4, 1, 1, 1, 1]> + q^4*|[1], [3, 2, 2, 1]>\n + q^5*|[1], [3, 2, 1, 1, 1]>\n sage: A(F(G[[2,1],[4,1,1]]))\n A([2, 1], [4, 1, 1]) - A([2], [4, 2, 1])\n sage: G(F(A[[2,1],[4,1,1]]))\n G([2, 1], [4, 1, 1]) + G([2], [4, 2, 1])\n\n For level `0`, the truncated Fock space of [GW1999]_\n is implemented. This can be used to improve the speed\n of the computation of the lower global crystal basis,\n provided the truncation is not too small::\n\n sage: FS = FockSpace(2)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: FS3 = FockSpace(2, truncated=3)\n sage: F3 = FS3.natural()\n sage: G3 = FS3.G()\n sage: F(G[6,2,1])\n |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2> + q^3*|5, 2, 1, 1>\n + q*|4, 2, 1, 1, 1> + q^2*|3, 3, 1, 1, 1> + q^3*|3, 2, 2, 1, 1>\n + q^4*|3, 2, 1, 1, 1, 1>\n sage: F3(G3[6,2,1])\n |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2>\n sage: FS5 = FockSpace(2, truncated=5)\n sage: F5 = FS5.natural()\n sage: G5 = FS5.G()\n sage: F5(G5[6,2,1])\n |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2> + q^3*|5, 2, 1, 1>\n + q*|4, 2, 1, 1, 1> + q^2*|3, 3, 1, 1, 1> + q^3*|3, 2, 2, 1, 1>\n\n REFERENCES:\n\n - [Ariki1996]_\n - [LLT1996]_\n - [Fayers2010]_\n - [GW1999]_\n '
@staticmethod
def __classcall_private__(cls, n, multicharge=[0], q=None, base_ring=None, truncated=None):
'\n Standardize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: R.<q> = ZZ[]\n sage: F1 = FockSpace(3, [0])\n sage: F2 = FockSpace(3, 0, q)\n sage: F3 = FockSpace(3, (0,), q, R)\n sage: F1 is F2 and F2 is F3\n True\n '
if (q is None):
base_ring = PolynomialRing(ZZ, 'q')
q = base_ring.gen(0)
if (base_ring is None):
base_ring = q.parent()
base_ring = FractionField(base_ring)
q = base_ring(q)
M = IntegerModRing(n)
if (multicharge in ZZ):
multicharge = (multicharge,)
multicharge = tuple((M(e) for e in multicharge))
if (truncated is not None):
return FockSpaceTruncated(n, truncated, q, base_ring)
return super().__classcall__(cls, n, multicharge, q, base_ring)
def __init__(self, n, multicharge, q, base_ring):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(3, [0])\n sage: TestSuite(F).run()\n sage: F = FockSpace(3, [1, 2])\n sage: TestSuite(F).run()\n '
self._n = n
self._q = q
self._multicharge = multicharge
self._index_set = set(range(n))
cat = ModulesWithBasis(base_ring).WithRealizations()
Parent.__init__(self, base=base_ring, category=cat)
self._realizations = [self.natural(), self.A(), self.G()]
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: FockSpace(2)\n Fock space of rank 2 of multicharge (0,) over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring\n sage: FockSpace(4, [2, 0, 1])\n Fock space of rank 4 of multicharge (2, 0, 1) over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring\n '
return 'Fock space of rank {} of multicharge {} over {}'.format(self._n, self._multicharge, self.base_ring())
def _latex_(self):
'\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: latex(F)\n \\mathcal{F}_{q}^{2}\\left(0\\right)\n sage: F = FockSpace(4, [2, 0, 1])\n sage: latex(F)\n \\mathcal{F}_{q}^{4}\\left(2, 0, 1\\right)\n '
from sage.misc.latex import latex
return '\\mathcal{{F}}_{{{q}}}^{{{n}}}{mc}'.format(q=latex(self._q), n=self._n, mc=latex(self._multicharge))
options = FockSpaceOptions
def q(self):
'\n Return the parameter `q` of ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F.q()\n q\n\n sage: F = FockSpace(2, q=-1)\n sage: F.q()\n -1\n '
return self._q
def multicharge(self):
'\n Return the multicharge of ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F.multicharge()\n (0,)\n\n sage: F = FockSpace(4, [2, 0, 1])\n sage: F.multicharge()\n (2, 0, 1)\n '
return self._multicharge
def a_realization(self):
'\n Return a realization of ``self``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: FS.a_realization()\n Fock space of rank 2 of multicharge (0,) over\n Fraction Field of Univariate Polynomial Ring in q over Integer Ring\n in the natural basis\n '
return self.natural()
def inject_shorthands(self, verbose=True):
'\n Import standard shorthands into the global namespace.\n\n INPUT:\n\n - ``verbose`` -- boolean (default ``True``) if ``True``, prints\n the defined shorthands\n\n EXAMPLES::\n\n sage: FS = FockSpace(4)\n sage: FS.inject_shorthands()\n Injecting A as shorthand for Fock space of rank 4\n of multicharge (0,) over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring\n in the approximation basis\n Injecting F as shorthand for Fock space of rank 4\n of multicharge (0,) over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring\n in the natural basis\n Injecting G as shorthand for Fock space of rank 4\n of multicharge (0,) over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring\n in the lower global crystal basis\n '
from sage.misc.misc import inject_variable
for shorthand in ['A', 'F', 'G']:
realization = getattr(self, shorthand)()
if verbose:
print('Injecting {} as shorthand for {}'.format(shorthand, realization))
inject_variable(shorthand, realization)
def highest_weight_vector(self):
'\n Return the module generator of ``self`` in the natural basis.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: FS.highest_weight_vector()\n |>\n sage: FS = FockSpace(4, [2, 0, 1])\n sage: FS.highest_weight_vector()\n |[], [], []>\n '
return self.natural().highest_weight_vector()
def __getitem__(self, i):
'\n Return the basis element indexed by ``i``.\n\n INPUT:\n\n - ``i`` -- a partition\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: FS[[]]\n |>\n sage: FS[1]\n |1>\n sage: FS[2,2,1]\n |2, 2, 1>\n\n sage: FS = FockSpace(3, [1, 2])\n sage: FS[[], []]\n |[], []>\n sage: FS[[2,1], [3,1,1]]\n |[2, 1], [3, 1, 1]>\n '
return self.natural()[i]
class F(CombinatorialFreeModule, BindableClass):
'\n The natural basis of the Fock space.\n\n This is the basis indexed by partitions. This has an action\n of the quantum group `U_q(\\widehat{\\mathfrak{sl}}_n)`\n described in\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpace`.\n\n EXAMPLES:\n\n We construct the natural basis and perform some computations::\n\n sage: F = FockSpace(4).natural()\n sage: q = F.q()\n sage: u = F.highest_weight_vector()\n sage: u\n |>\n sage: u.f(0,1,2)\n |3>\n sage: u.f(0,1,3)\n |2, 1>\n sage: u.f(0,1,2,0)\n 0\n sage: u.f(0,1,3,2)\n |3, 1> + q*|2, 1, 1>\n sage: u.f(0,1,2,3)\n |4> + q*|3, 1>\n sage: u.f(0,1,3,2,2,0)\n ((q^2+1)/q)*|3, 2, 1>\n sage: x = (q^4 * u + u.f(0,1,3,(2,2)))\n sage: x\n |3, 1, 1> + q^4*|>\n sage: x.f(0,1,3)\n |4, 3, 1> + q*|4, 2, 1, 1> + q*|3, 3, 2>\n + q^2*|3, 2, 2, 1> + q^4*|2, 1>\n sage: x.h_inverse(2)\n q^2*|3, 1, 1> + q^4*|>\n sage: x.h_inverse(0)\n 1/q*|3, 1, 1> + q^3*|>\n sage: x.d()\n 1/q*|3, 1, 1> + q^4*|>\n sage: x.e(2)\n |3, 1> + q*|2, 1, 1>\n '
def __init__(self, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2).natural()\n sage: TestSuite(F).run() # long time\n '
self._basis_name = 'natural'
if (len(F._multicharge) == 1):
self._above = (lambda x, y: (x[0] < y[0]))
else:
self._above = (lambda x, y: ((x[0] < y[0]) or ((x[0] == y[0]) and (x[1] < y[1]))))
self._addable = (lambda la, i: [x for x in la.outside_corners() if (la.content(*x, multicharge=F._multicharge) == i)])
self._removable = (lambda la, i: [x for x in la.corners() if (la.content(*x, multicharge=F._multicharge) == i)])
indices = PartitionTuples(level=len(F._multicharge))
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='F', latex_prefix='', bracket=False, latex_bracket=['\\left\\lvert', '\\right\\rangle'], sorting_reverse=True, category=FockSpaceBases(F))
options = FockSpaceOptions
def _repr_term(self, m):
"\n Return a representation of the monomial indexed by ``m``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2).natural()\n sage: F._repr_term(Partition([2,1,1]))\n '|2, 1, 1>'\n sage: F.highest_weight_vector()\n |>\n sage: F = FockSpace(2, [2, 1, 1]).natural()\n sage: mg = F.highest_weight_vector(); mg\n |[], [], []>\n sage: q = F.q()\n sage: mg.f(1).f(1).f(0) / (q^-1 + q)\n |[1], [1], [1]> + q*|[], [2], [1]> + q^2*|[], [1, 1], [1]>\n + q^3*|[], [1], [2]> + q^4*|[], [1], [1, 1]>\n "
if (self.options.display != 'ket'):
return CombinatorialFreeModule._repr_term(self, m)
return (('|' + m._repr_list()[1:(- 1)]) + '>')
def _ascii_art_term(self, m):
'\n Return a representation of the monomial indexed by ``m``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(4)\n sage: F = FS.natural()\n sage: x = F.an_element()\n sage: ascii_art(x)\n 3*|**> + 2*|*> + 2*|->\n sage: ascii_art(x.f(3,2,2,0,1))\n ((3*q^2+3)/q)*|***\\ + (3*q^2+3)*|***\\\n |*** > |** \\\n |* / |* /\n |* /\n '
if (self.options.display != 'ket'):
return CombinatorialFreeModule._ascii_art_term(self, m)
from sage.typeset.ascii_art import AsciiArt, ascii_art
a = ascii_art(m)
h = a.height()
l = AsciiArt((['|'] * h))
r = AsciiArt([((' ' * i) + '\\') for i in range((h // 2))], baseline=0)
if (h % 2):
r *= AsciiArt([((' ' * (h // 2)) + '>')], baseline=0)
r *= AsciiArt([((' ' * i) + '/') for i in reversed(range((h // 2)))], baseline=0)
ret = ((l + a) + r)
ret._baseline = (h - 1)
return ret
def _unicode_art_term(self, m):
'\n Return an unicode art representing the generator indexed by ``m``.\n\n TESTS::\n\n sage: FS = FockSpace(4)\n sage: F = FS.natural()\n sage: x = F.an_element()\n sage: unicode_art(x)\n 3*│┌┬┐╲ + 2*│┌┐╲ + 2*│∅〉\n │└┴┘╱ │└┘╱\n sage: unicode_art(x.f(3,2,2,0,1))\n ((3*q^2+3)/q)*│┌┬┬┐╲ + (3*q^2+3)*│┌┬┬┐╲\n │├┼┼┤ ╲ │├┼┼┘ ╲\n │├┼┴┘ ╱ │├┼┘ 〉\n │└┘ ╱ │├┤ ╱\n │└┘ ╱\n '
if (self.options.display != 'ket'):
return CombinatorialFreeModule._ascii_art_term(self, m)
from sage.typeset.unicode_art import UnicodeArt, unicode_art
a = unicode_art(m)
h = a.height()
l = UnicodeArt((['│'] * h), baseline=0)
r = UnicodeArt([((' ' * i) + '╲') for i in range((h // 2))], baseline=0)
if (h % 2):
r *= UnicodeArt([((' ' * (h // 2)) + '〉')], baseline=0)
r *= UnicodeArt([((' ' * i) + '╱') for i in reversed(range((h // 2)))], baseline=0)
ret = ((l + a) + r)
ret._baseline = (h - 1)
return ret
def _test_representation(self, **options):
'\n Test that ``self`` is a\n `U_q(\\widehat{\\mathfrak{sl}}_n)`-representation.\n\n EXAMPLES::\n\n sage: F = FockSpace(3, [0,1]).natural()\n sage: F._test_representation() # long time\n '
from sage.combinat.root_system.cartan_matrix import CartanMatrix
from sage.combinat.root_system.root_system import RootSystem
from sage.algebras.quantum_groups.q_numbers import q_binomial
tester = self._tester(**options)
F = self.realization_of()
q = F.q()
n = F._n
I = F._index_set
A = CartanMatrix(['A', (n - 1), 1])
P = RootSystem(['A', (n - 1), 1]).weight_lattice()
al = P.simple_roots()
ac = P.simple_coroots()
zero = self.zero()
for x in self.some_elements():
for i in I:
for j in I:
tester.assertEqual(x.h_inverse(j).f(i).h(j), ((q ** (- al[i].scalar(ac[j]))) * x.f(i)))
tester.assertEqual(x.h_inverse(j).e(i).h(j), ((q ** al[i].scalar(ac[j])) * x.e(i)))
if (i == j):
tester.assertEqual((x.f(i).e(i) - x.e(i).f(i)), ((x.h(i) - x.h_inverse(i)) / (q - (q ** (- 1)))))
continue
tester.assertEqual((x.f(j).e(i) - x.e(i).f(j)), zero)
aij = A[(i, j)]
tester.assertEqual(zero, sum((((((- 1) ** k) * q_binomial((1 - aij), k, q)) * x.e(*((([i] * ((1 - aij) - k)) + [j]) + ([i] * k)))) for k in range(((1 - aij) + 1)))))
tester.assertEqual(zero, sum((((((- 1) ** k) * q_binomial((1 - aij), k, q)) * x.f(*((([i] * ((1 - aij) - k)) + [j]) + ([i] * k)))) for k in range(((1 - aij) + 1)))))
class Element(CombinatorialFreeModule.Element):
'\n An element in the Fock space.\n '
def _e(self, i):
'\n Apply `e_i` to ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F[2,1,1]._e(1)\n 1/q*|1, 1, 1>\n sage: F[2,1,1]._e(0)\n |2, 1>\n sage: F[3,2,1]._e(1)\n 0\n\n sage: F = FockSpace(4, [2, 0, 1])\n sage: F[[2,1],[1],[2]]._e(2)\n |[2, 1], [1], [1]>\n '
P = self.parent()
def N_left(la, x, i):
return (sum((1 for y in P._addable(la, i) if P._above(x, y))) - sum((1 for y in P._removable(la, i) if P._above(x, y))))
q = P.realization_of()._q
return P.sum_of_terms(((la.remove_cell(*x), (c * (q ** (- N_left(la, x, i))))) for (la, c) in self for x in P._removable(la, i)))
def e(self, *data):
'\n Apply the action of the divided difference operator\n `e_i^{(p)}` on ``self``.\n\n INPUT:\n\n - ``*data`` -- a list of indices or pairs `(i, p)`\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F[2,1,1].e(1)\n 1/q*|1, 1, 1>\n sage: F[2,1,1].e(0)\n |2, 1>\n sage: F[2,1,1].e(0).e(1)\n |2> + q*|1, 1>\n sage: F[2,1,1].e(0).e(1).e(1)\n ((q^2+1)/q)*|1>\n sage: F[2,1,1].e(0).e((1, 2))\n |1>\n sage: F[2,1,1].e(0, 1, 1, 1)\n 0\n sage: F[2,1,1].e(0, (1, 3))\n 0\n sage: F[2,1,1].e(0, (1,2), 0)\n |>\n sage: F[2,1,1].e(1, 0, 1, 0)\n 1/q*|>\n\n sage: F = FockSpace(4, [2, 0, 1])\n sage: F[[2,1],[1],[2]]\n |[2, 1], [1], [2]>\n sage: F[[2,1],[1],[2]].e(2)\n |[2, 1], [1], [1]>\n sage: F[[2,1],[1],[2]].e(1)\n 1/q*|[2], [1], [2]>\n sage: F[[2,1],[1],[2]].e(0)\n 1/q*|[2, 1], [], [2]>\n sage: F[[2,1],[1],[2]].e(3)\n 1/q^2*|[1, 1], [1], [2]>\n sage: F[[2,1],[1],[2]].e(3, 2, 1)\n 1/q^2*|[1, 1], [1], []> + 1/q^2*|[1], [1], [1]>\n sage: F[[2,1],[1],[2]].e(3, 2, 1, 0, 1, 2)\n 2/q^3*|[], [], []>\n '
ret = self
q = self.parent().realization_of()._q
I = self.parent().realization_of()._index_set
for i in data:
if isinstance(i, tuple):
(i, p) = i
else:
p = 1
if (i not in I):
raise ValueError('{} not in the index set'.format(i))
for _ in range(p):
ret = ret._e(i)
if (p > 1):
ret = (ret / q_factorial(p, q))
return ret
def _f(self, i):
'\n Apply `f_i` to ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F.highest_weight_vector()._f(0)\n |1>\n sage: F[5,2,2,1]._f(0)\n 1/q*|5, 2, 2, 2> + |5, 2, 2, 1, 1>\n sage: F[5,2,2,1]._f(1)\n |6, 2, 2, 1> + q*|5, 3, 2, 1>\n\n sage: F = FockSpace(4, [2, 0, 1])\n sage: F[[3,1], [1,1,1], [4,2,2]]._f(0)\n 1/q*|[3, 1, 1], [1, 1, 1], [4, 2, 2]>\n sage: F[[3,1], [1,1,1], [4,2,2]]._f(1)\n |[4, 1], [1, 1, 1], [4, 2, 2]>\n + |[3, 1], [2, 1, 1], [4, 2, 2]>\n + q*|[3, 1], [1, 1, 1, 1], [4, 2, 2]>\n + q^2*|[3, 1], [1, 1, 1], [5, 2, 2]>\n '
P = self.parent()
def N_right(la, x, i):
return (sum((1 for y in P._addable(la, i) if P._above(y, x))) - sum((1 for y in P._removable(la, i) if P._above(y, x))))
q = P.realization_of()._q
return P.sum_of_terms(((la.add_cell(*x), (c * (q ** N_right(la, x, i)))) for (la, c) in self for x in P._addable(la, i)))
def f(self, *data):
'\n Apply the action of the divided difference operator\n `f_i^{(p)}` on ``self``.\n\n INPUT:\n\n - ``*data`` -- a list of indices or pairs `(i, p)`\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: mg = F.highest_weight_vector()\n sage: mg.f(0)\n |1>\n sage: mg.f(0).f(1)\n |2> + q*|1, 1>\n sage: mg.f(0).f(0)\n 0\n sage: mg.f((0, 2))\n 0\n sage: mg.f(0, 1, 1)\n ((q^2+1)/q)*|2, 1>\n sage: mg.f(0, (1, 2))\n |2, 1>\n sage: mg.f(0, 1, 0)\n |3> + q*|1, 1, 1>\n\n sage: F = FockSpace(4, [2, 0, 1])\n sage: mg = F.highest_weight_vector()\n sage: mg.f(0)\n |[], [1], []>\n sage: mg.f(2)\n |[1], [], []>\n sage: mg.f(1)\n |[], [], [1]>\n sage: mg.f(1, 0)\n |[], [1], [1]> + q*|[], [], [1, 1]>\n sage: mg.f(0, 1)\n |[], [2], []> + q*|[], [1], [1]>\n sage: mg.f(0, 1, 3)\n |[], [2, 1], []> + q*|[], [1, 1], [1]>\n sage: mg.f(3)\n 0\n '
ret = self
q = self.parent().realization_of()._q
I = self.parent().realization_of()._index_set
for i in data:
if isinstance(i, tuple):
(i, p) = i
else:
p = 1
if (i not in I):
raise ValueError('{} not in the index set'.format(i))
for _ in range(p):
ret = ret._f(i)
if (p > 1):
ret = (ret / q_factorial(p, q))
return ret
def h(self, *data):
'\n Apply the action of `h_i` on ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F[2,1,1].h(0)\n q*|2, 1, 1>\n sage: F[2,1,1].h(1)\n |2, 1, 1>\n sage: F[2,1,1].h(0, 0)\n q^2*|2, 1, 1>\n\n sage: F = FockSpace(4, [2,0,1])\n sage: elt = F[[2,1],[1],[2]]\n sage: elt.h(0)\n q^2*|[2, 1], [1], [2]>\n sage: elt.h(1)\n |[2, 1], [1], [2]>\n sage: elt.h(2)\n |[2, 1], [1], [2]>\n sage: elt.h(3)\n q*|[2, 1], [1], [2]>\n '
P = self.parent()
q = P.realization_of()._q
I = self.parent().realization_of()._index_set
d = self.monomial_coefficients(copy=True)
for i in data:
if (i not in I):
raise ValueError('{} not in the index set'.format(i))
for la in d:
d[la] *= (q ** (len(P._addable(la, i)) - len(P._removable(la, i))))
return P._from_dict(d, coerce=False)
def h_inverse(self, *data):
'\n Apply the action of `h_i^{-1}` on ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F[2,1,1].h_inverse(0)\n 1/q*|2, 1, 1>\n sage: F[2,1,1].h_inverse(1)\n |2, 1, 1>\n sage: F[2,1,1].h_inverse(0, 0)\n 1/q^2*|2, 1, 1>\n\n sage: F = FockSpace(4, [2,0,1])\n sage: elt = F[[2,1],[1],[2]]\n sage: elt.h_inverse(0)\n 1/q^2*|[2, 1], [1], [2]>\n sage: elt.h_inverse(1)\n |[2, 1], [1], [2]>\n sage: elt.h_inverse(2)\n |[2, 1], [1], [2]>\n sage: elt.h_inverse(3)\n 1/q*|[2, 1], [1], [2]>\n '
P = self.parent()
q = P.realization_of()._q
I = self.parent().realization_of()._index_set
d = self.monomial_coefficients(copy=True)
for i in data:
if (i not in I):
raise ValueError('{} not in the index set'.format(i))
for la in d:
d[la] *= (q ** (- (len(P._addable(la, i)) - len(P._removable(la, i)))))
return P._from_dict(d, coerce=False)
def d(self):
'\n Apply the action of `d` on ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2)\n sage: F.highest_weight_vector().d()\n |>\n sage: F[2,1,1].d()\n 1/q^2*|2, 1, 1>\n sage: F[5,3,3,1,1,1].d()\n 1/q^7*|5, 3, 3, 1, 1, 1>\n\n sage: F = FockSpace(4, [2,0,1])\n sage: F.highest_weight_vector().d()\n |[], [], []>\n sage: F[[2,1],[1],[2]].d()\n 1/q*|[2, 1], [1], [2]>\n sage: F[[4,2,2,1],[1],[5,2]].d()\n 1/q^5*|[4, 2, 2, 1], [1], [5, 2]>\n '
P = self.parent()
R = P.realization_of()
q = R._q
d = self.monomial_coefficients(copy=True)
for la in d:
d[la] *= (q ** (- sum((1 for x in la.cells() if (la.content(*x, multicharge=R._multicharge) == 0)))))
return P._from_dict(d, coerce=False)
natural = F
class A(CombinatorialFreeModule, BindableClass):
'\n The `A` basis of the Fock space which is the approximation\n of the lower global crystal basis.\n\n The approximation basis `A` is a basis that is constructed\n from the highest weight element by applying divided\n difference operators using the ladder construction of\n [LLT1996]_ and [GW1999]_. Thus, this basis is bar invariant\n and upper unitriangular (using dominance order on partitions)\n when expressed in the natural basis. This basis is then\n converted to the lower global crystal basis by using\n Gaussian elimination.\n\n EXAMPLES:\n\n We construct Example 6.5 and 6.7 in [LLT1996]_::\n\n sage: FS = FockSpace(2)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: A = FS.A()\n sage: F(A[5])\n |5> + |3, 2> + 2*q*|3, 1, 1> + q^2*|2, 2, 1> + q^2*|1, 1, 1, 1, 1>\n sage: F(A[4,1])\n |4, 1> + q*|2, 1, 1, 1>\n sage: F(A[3,2])\n |3, 2> + q*|3, 1, 1> + q^2*|2, 2, 1>\n sage: F(G[5])\n |5> + q*|3, 1, 1> + q^2*|1, 1, 1, 1, 1>\n\n We construct the examples in Section 5.1 of [Fayers2010]_::\n\n sage: FS = FockSpace(2, [0, 0])\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: F(A[[2,1],[1]])\n |[2, 1], [1]> + q*|[2], [2]> + q^2*|[2], [1, 1]> + q^2*|[1, 1], [2]>\n + q^3*|[1, 1], [1, 1]> + q^4*|[1], [2, 1]>\n sage: F(A[[4],[]])\n |[4], []> + q*|[3, 1], []> + q*|[2, 1, 1], []>\n + (q^2+1)*|[2, 1], [1]> + 2*q*|[2], [2]> + 2*q^2*|[2], [1, 1]>\n + q^2*|[1, 1, 1, 1], []> + 2*q^2*|[1, 1], [2]>\n + 2*q^3*|[1, 1], [1, 1]> + (q^4+q^2)*|[1], [2, 1]>\n + q^2*|[], [4]> + q^3*|[], [3, 1]> + q^3*|[], [2, 1, 1]>\n + q^4*|[], [1, 1, 1, 1]>\n '
def __init__(self, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: A = FockSpace(2).A()\n sage: TestSuite(A).run()\n '
self._basis_name = 'approximation'
indices = PartitionTuples(level=len(F._multicharge), regular=F._n)
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='A', bracket=False, sorting_reverse=True, category=FockSpaceBases(F))
self.module_morphism(self._A_to_fock_basis, triangular='upper', unitriangular=True, codomain=F.natural()).register_as_coercion()
options = FockSpaceOptions
@cached_method
def _A_to_fock_basis(self, la):
'\n Return the `A` basis indexed by ``la`` in the natural basis.\n\n EXAMPLES::\n\n sage: A = FockSpace(3).A()\n sage: A._A_to_fock_basis(Partition([3]))\n |3> + q*|2, 1>\n sage: A._A_to_fock_basis(Partition([2,1]))\n |2, 1> + q*|1, 1, 1>\n\n sage: FS = FockSpace(2, [0,1])\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: F(A[[],[1]])\n |[], [1]>\n '
R = self.realization_of()
fock = R.natural()
if (la.size() == 0):
return fock.highest_weight_vector()
if (len(R._multicharge) > 1):
k = 1
for p in la:
if (p.size() != 0):
break
k += 1
if (k == len(R._multicharge)):
cur = fock.highest_weight_vector()
else:
F = FockSpace(R._n, R._multicharge[k:], R._q, R.base_ring())
Gp = F.G()
if ((k + 1) == len(R._multicharge)):
cur = Gp._G_to_fock_basis(Gp._indices(la[k]))
cur = fock.sum_of_terms(((fock._indices((([[]] * k) + [p])), c) for (p, c) in cur))
else:
cur = Gp._G_to_fock_basis(Gp._indices(la[k:]))
cur = fock.sum_of_terms(((fock._indices((([[]] * k) + list(pt))), c) for (pt, c) in cur))
la = la[(k - 1)]
r = R._multicharge[(k - 1)]
else:
cur = fock.highest_weight_vector()
r = R._multicharge[0]
corners = la.corners()
cells = set(la.cells())
q = R._q
k = (R._n - 1)
b = ZZ.zero()
while any(((((c[1] * k) + c[0]) >= b) for c in corners)):
power = 0
i = ((- b) + r)
for x in range(((b // k) + 1)):
if (((b - (x * k)), x) in cells):
power += 1
cur = cur.f(i)
cur /= q_factorial(power, q)
b += 1
return cur
approximation = A
class G(CombinatorialFreeModule, BindableClass):
'\n The lower global crystal basis living inside of Fock space.\n\n EXAMPLES:\n\n We construct some of the tables/entries given in Section 10\n of [LLT1996]_. For `\\widehat{\\mathfrak{sl}}_2`::\n\n sage: FS = FockSpace(2)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[2])\n |2> + q*|1, 1>\n sage: F(G[3])\n |3> + q*|1, 1, 1>\n sage: F(G[2,1])\n |2, 1>\n sage: F(G[4])\n |4> + q*|3, 1> + q*|2, 1, 1> + q^2*|1, 1, 1, 1>\n sage: F(G[3,1])\n |3, 1> + q*|2, 2> + q^2*|2, 1, 1>\n sage: F(G[5])\n |5> + q*|3, 1, 1> + q^2*|1, 1, 1, 1, 1>\n sage: F(G[4,2])\n |4, 2> + q*|4, 1, 1> + q*|3, 3> + q^2*|3, 1, 1, 1>\n + q^2*|2, 2, 2> + q^3*|2, 2, 1, 1>\n sage: F(G[4,2,1])\n |4, 2, 1> + q*|3, 3, 1> + q^2*|3, 2, 2> + q^3*|3, 2, 1, 1>\n sage: F(G[6,2])\n |6, 2> + q*|6, 1, 1> + q*|5, 3> + q^2*|5, 1, 1, 1> + q*|4, 3, 1>\n + q^2*|4, 2, 2> + (q^3+q)*|4, 2, 1, 1> + q^2*|4, 1, 1, 1, 1>\n + q^2*|3, 3, 1, 1> + q^3*|3, 2, 2, 1> + q^3*|3, 1, 1, 1, 1, 1>\n + q^3*|2, 2, 2, 1, 1> + q^4*|2, 2, 1, 1, 1, 1>\n sage: F(G[5,3,1])\n |5, 3, 1> + q*|5, 2, 2> + q^2*|5, 2, 1, 1> + q*|4, 4, 1>\n + q^2*|4, 2, 1, 1, 1> + q^2*|3, 3, 3> + q^3*|3, 3, 1, 1, 1>\n + q^3*|3, 2, 2, 2> + q^4*|3, 2, 2, 1, 1>\n sage: F(G[4,3,2,1])\n |4, 3, 2, 1>\n sage: F(G[7,2,1])\n |7, 2, 1> + q*|5, 2, 1, 1, 1> + q^2*|3, 2, 1, 1, 1, 1, 1>\n sage: F(G[10,1])\n |10, 1> + q*|8, 1, 1, 1> + q^2*|6, 1, 1, 1, 1, 1>\n + q^3*|4, 1, 1, 1, 1, 1, 1, 1>\n + q^4*|2, 1, 1, 1, 1, 1, 1, 1, 1, 1>\n sage: F(G[6,3,2])\n |6, 3, 2> + q*|6, 3, 1, 1> + q^2*|6, 2, 2, 1> + q^3*|5, 3, 2, 1>\n + q*|4, 3, 2, 1, 1> + q^2*|4, 3, 1, 1, 1, 1>\n + q^3*|4, 2, 2, 1, 1, 1> + q^4*|3, 3, 2, 1, 1, 1>\n sage: F(G[5,3,2,1])\n |5, 3, 2, 1> + q*|4, 4, 2, 1> + q^2*|4, 3, 3, 1>\n + q^3*|4, 3, 2, 2> + q^4*|4, 3, 2, 1, 1>\n\n For `\\widehat{\\mathfrak{sl}}_3`::\n\n sage: FS = FockSpace(3)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[2])\n |2>\n sage: F(G[1,1])\n |1, 1>\n sage: F(G[3])\n |3> + q*|2, 1>\n sage: F(G[2,1])\n |2, 1> + q*|1, 1, 1>\n sage: F(G[4])\n |4> + q*|2, 2>\n sage: F(G[3,1])\n |3, 1>\n sage: F(G[2,2])\n |2, 2> + q*|1, 1, 1, 1>\n sage: F(G[2,1,1])\n |2, 1, 1>\n sage: F(G[5])\n |5> + q*|2, 2, 1>\n sage: F(G[2,2,1])\n |2, 2, 1> + q*|2, 1, 1, 1>\n sage: F(G[4,1,1])\n |4, 1, 1> + q*|3, 2, 1> + q^2*|3, 1, 1, 1>\n sage: F(G[5,2])\n |5, 2> + q*|4, 3> + q^2*|4, 2, 1>\n sage: F(G[8])\n |8> + q*|5, 2, 1> + q*|3, 3, 1, 1> + q^2*|2, 2, 2, 2>\n sage: F(G[7,2])\n |7, 2> + q*|4, 2, 2, 1>\n sage: F(G[6,2,2])\n |6, 2, 2> + q*|6, 1, 1, 1, 1> + q*|4, 4, 2> + q^2*|3, 3, 2, 1, 1>\n\n For `\\widehat{\\mathfrak{sl}}_4`::\n\n sage: FS = FockSpace(4)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[4])\n |4> + q*|3, 1>\n sage: F(G[3,1])\n |3, 1> + q*|2, 1, 1>\n sage: F(G[2,2])\n |2, 2>\n sage: F(G[2,1,1])\n |2, 1, 1> + q*|1, 1, 1, 1>\n sage: F(G[3,2])\n |3, 2> + q*|2, 2, 1>\n sage: F(G[2,2,2])\n |2, 2, 2> + q*|1, 1, 1, 1, 1, 1>\n sage: F(G[6,1])\n |6, 1> + q*|4, 3>\n sage: F(G[3,2,2,1])\n |3, 2, 2, 1> + q*|3, 1, 1, 1, 1, 1> + q*|2, 2, 2, 2>\n + q^2*|2, 1, 1, 1, 1, 1, 1>\n sage: F(G[7,2])\n |7, 2> + q*|6, 2, 1> + q*|5, 4> + q^2*|5, 3, 1>\n sage: F(G[5,2,2,1])\n |5, 2, 2, 1> + q*|5, 1, 1, 1, 1, 1> + q*|4, 2, 2, 1, 1>\n + q^2*|4, 2, 1, 1, 1, 1>\n\n We construct the examples in Section 5.1 of [Fayers2010]_::\n\n sage: FS = FockSpace(2, [0, 0])\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[[2,1],[1]])\n |[2, 1], [1]> + q*|[2], [2]> + q^2*|[2], [1, 1]>\n + q^2*|[1, 1], [2]> + q^3*|[1, 1], [1, 1]> + q^4*|[1], [2, 1]>\n sage: F(G[[4],[]])\n |[4], []> + q*|[3, 1], []> + q*|[2, 1, 1], []> + q^2*|[2, 1], [1]>\n + q*|[2], [2]> + q^2*|[2], [1, 1]> + q^2*|[1, 1, 1, 1], []>\n + q^2*|[1, 1], [2]> + q^3*|[1, 1], [1, 1]> + q^2*|[1], [2, 1]>\n + q^2*|[], [4]> + q^3*|[], [3, 1]> + q^3*|[], [2, 1, 1]>\n + q^4*|[], [1, 1, 1, 1]>\n '
def __init__(self, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: G = FockSpace(2).G()\n sage: TestSuite(G).run()\n '
self._basis_name = 'lower global crystal'
indices = PartitionTuples(level=len(F._multicharge), regular=F._n)
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='G', bracket=False, sorting_reverse=True, category=FockSpaceBases(F))
self.module_morphism(self._G_to_fock_basis, triangular='upper', unitriangular=True, codomain=F.natural()).register_as_coercion()
options = FockSpaceOptions
@cached_method
def _G_to_fock_basis(self, la):
'\n Return the `G` basis indexed by ``la`` in the natural basis.\n\n EXAMPLES::\n\n sage: G = FockSpace(3).G()\n sage: G._G_to_fock_basis(Partition([3]))\n |3> + q*|2, 1>\n sage: G._G_to_fock_basis(Partition([2,1]))\n |2, 1> + q*|1, 1, 1>\n '
if (la.size() == 0):
return self.realization_of().natural().highest_weight_vector()
R = self.realization_of()
if ((len(R._multicharge) > 1) and (la[0].size() == 0)):
fock = R.natural()
k = 0
for p in la:
if (p.size() != 0):
break
k += 1
F = FockSpace(R._n, R._multicharge[k:], R._q, R.base_ring())
Gp = F.G()
if ((k + 1) == len(R._multicharge)):
cur = Gp._G_to_fock_basis(Gp._indices(la[k]))
return fock.sum_of_terms(((fock._indices((([[]] * k) + [p])), c) for (p, c) in cur))
cur = Gp._G_to_fock_basis(Gp._indices(la[k:]))
return fock.sum_of_terms(((fock._indices((([[]] * k) + list(pt))), c) for (pt, c) in cur))
cur = R.A()._A_to_fock_basis(la)
s = sorted(cur.support())
s.pop()
q = R._q
while s:
mu = s.pop()
d = cur[mu].denominator()
k = d.degree()
n = cur[mu].numerator()
if ((k != 0) or (n.constant_coefficient() != 0)):
gamma = sum(((n[i] * ((q ** (i - k)) + (q ** (k - i)))) for i in range(min(n.degree(), k))))
gamma += n[k]
cur -= (gamma * self._G_to_fock_basis(mu))
for x in cur.support():
if ((x == mu) or (not mu.dominates(x))):
continue
for i in reversed(range(len(s))):
if (not s[i].dominates(x)):
s.insert((i + 1), x)
break
return cur
lower_global_crystal = G
canonical = G
|
class FockSpaceBases(Category_realization_of_parent):
'\n The category of bases of a (truncated) Fock space.\n '
def __init__(self, base):
'\n Initialize the bases of a Fock space.\n\n INPUT:\n\n - ``base`` -- a Fock space\n\n TESTS::\n\n sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases\n sage: F = FockSpace(2)\n sage: bases = FockSpaceBases(F)\n sage: TestSuite(bases).run()\n '
Category_realization_of_parent.__init__(self, base)
def _repr_(self):
'\n Return the representation of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases\n sage: F = FockSpace(2)\n sage: FockSpaceBases(F)\n Category of bases of Fock space of rank 2 of multicharge (0,) over\n Fraction Field of Univariate Polynomial Ring in q over Integer Ring\n '
return 'Category of bases of {}'.format(self.base())
def super_categories(self):
'\n The super categories of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases\n sage: F = FockSpace(2)\n sage: bases = FockSpaceBases(F)\n sage: bases.super_categories()\n [Category of vector spaces with basis over Fraction Field\n of Univariate Polynomial Ring in q over Integer Ring,\n Category of realizations of Fock space of rank 2 of multicharge (0,)\n over Fraction Field of Univariate Polynomial Ring in q over Integer Ring]\n '
return [ModulesWithBasis(self.base().base_ring()), Realizations(self.base())]
class ParentMethods():
def _repr_(self):
'\n Text representation of this basis of Fock space.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: FS.A()\n Fock space of rank 2 of multicharge (0,) over Fraction Field of\n Univariate Polynomial Ring in q over Integer Ring\n in the approximation basis\n sage: FS.G()\n Fock space of rank 2 of multicharge (0,) over Fraction Field of\n Univariate Polynomial Ring in q over Integer Ring\n in the lower global crystal basis\n '
return '{} in the {} basis'.format(self.realization_of(), self._basis_name)
def some_elements(self):
'\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(3).natural()\n sage: F.some_elements()[::13]\n [3*|2> + 2*|1> + 2*|>,\n |5>,\n |3, 1, 1, 1>,\n |3, 2, 2>,\n |5, 1, 1, 1>,\n |2, 2, 1, 1, 1, 1>,\n |5, 2, 1, 1>,\n |3, 2, 1, 1, 1, 1>]\n\n sage: F = FockSpace(3, [0,1]).natural()\n sage: F.some_elements()[::13]\n [2*|[1], []> + 4*|[], [1]> + |[], []>,\n |[1, 1], [1]>,\n |[1, 1, 1], [1]>,\n |[5], []>,\n |[3], [1, 1]>,\n |[1], [2, 2]>,\n |[4, 1, 1], []>,\n |[2, 1, 1, 1], [1]>]\n '
others = [self.monomial(la) for la in self.basis().keys().some_elements()]
return ([self.an_element()] + others)
def q(self):
'\n Return the parameter `q` of ``self``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: A = FS.A()\n sage: A.q()\n q\n\n sage: FS = FockSpace(2, q=-1)\n sage: G = FS.G()\n sage: G.q()\n -1\n '
return self.realization_of()._q
def multicharge(self):
'\n Return the multicharge of ``self``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(4)\n sage: A = FS.A()\n sage: A.multicharge()\n (0,)\n\n sage: FS = FockSpace(4, [1,0,2])\n sage: G = FS.G()\n sage: G.multicharge()\n (1, 0, 2)\n '
return self.realization_of()._multicharge
@cached_method
def highest_weight_vector(self):
'\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2)\n sage: F = FS.natural()\n sage: F.highest_weight_vector()\n |>\n sage: A = FS.A()\n sage: A.highest_weight_vector()\n A[]\n sage: G = FS.G()\n sage: G.highest_weight_vector()\n G[]\n '
level = len(self.realization_of()._multicharge)
if (level == 1):
return self.monomial(self._indices([]))
return self.monomial(self._indices(([[]] * level)))
def __getitem__(self, i):
'\n Return the basis element indexed by ``i``.\n\n INPUT:\n\n - ``i`` -- a partition\n\n EXAMPLES::\n\n sage: F = FockSpace(3)\n sage: A = F.A()\n sage: A[[]]\n A[]\n sage: A[4]\n A[4]\n sage: A[2,2,1]\n A[2, 2, 1]\n sage: G = F.G()\n sage: G[[]]\n G[]\n sage: G[4]\n G[4]\n sage: G[2,2,1]\n G[2, 2, 1]\n\n For higher levels::\n\n sage: F = FockSpace(2, [0, 0])\n sage: G = F.G()\n sage: G[[2,1],[1]]\n G([2, 1], [1])\n\n TESTS::\n\n sage: F = FockSpace(3)\n sage: A = F.A()\n sage: A[2,2,2,1]\n Traceback (most recent call last):\n ...\n ValueError: [2, 2, 2, 1] is not an element of 3-Regular Partitions\n\n sage: F = FockSpace(3, [0, 0])\n sage: A = F.A()\n sage: A[[], [2,2,2,1]]\n Traceback (most recent call last):\n ...\n ValueError: [[], [2, 2, 2, 1]] is not a 3-Regular partition tuples of level 2\n '
if (i in ZZ):
i = [i]
i = self._indices(i)
if (i.size() == 0):
return self.highest_weight_vector()
return self.monomial(i)
|
class FockSpaceTruncated(FockSpace):
'\n This is the Fock space given by partitions of length no more than `k`.\n\n This can be formed as the quotient `\\mathcal{F} / \\mathcal{F}_k`,\n where `\\mathcal{F}_k` is the submodule spanned by all diagrams\n of length (strictly) more than `k`.\n\n We have three bases:\n\n - The natural basis indexed by truncated `n`-regular partitions:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.F`.\n - The approximation basis that comes from LLT(-type) algorithms:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.A`.\n - The lower global crystal basis:\n :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.G`.\n\n .. SEEALSO::\n\n :class:`FockSpace`\n\n EXAMPLES::\n\n sage: F = FockSpace(2, truncated=2)\n sage: mg = F.highest_weight_vector()\n sage: mg.f(0)\n |1>\n sage: mg.f(0).f(1)\n |2> + q*|1, 1>\n sage: mg.f(0).f(1).f(0)\n |3>\n\n Compare this to the full Fock space::\n\n sage: F = FockSpace(2)\n sage: mg = F.highest_weight_vector()\n sage: mg.f(0).f(1).f(0)\n |3> + q*|1, 1, 1>\n\n REFERENCES:\n\n - [GW1999]_\n '
@staticmethod
def __classcall_private__(cls, n, k, q=None, base_ring=None):
'\n Standardize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: R.<q> = ZZ[]\n sage: F1 = FockSpace(3, truncated=2)\n sage: F2 = FockSpace(3, q=q, truncated=2)\n sage: F3 = FockSpace(3, q=q, base_ring=R, truncated=2)\n sage: F1 is F2 and F2 is F3\n True\n sage: from sage.algebras.quantum_groups.fock_space import FockSpaceTruncated\n sage: F4 = FockSpaceTruncated(3, 2, q, R)\n sage: F1 is F4\n True\n '
if (q is None):
base_ring = PolynomialRing(ZZ, 'q')
q = base_ring.gen(0)
if (base_ring is None):
base_ring = q.parent()
base_ring = FractionField(base_ring)
q = base_ring(q)
return super().__classcall__(cls, n, k, q, base_ring)
def __init__(self, n, k, q, base_ring):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2, truncated=3)\n sage: TestSuite(F).run()\n '
M = IntegerModRing(n)
self._k = k
FockSpace.__init__(self, n, (M(0),), q, base_ring)
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: FockSpace(2, truncated=3)\n Fock space of rank 2 truncated at 3 over Fraction Field of\n Univariate Polynomial Ring in q over Integer Ring\n '
return 'Fock space of rank {} truncated at {} over {}'.format(self._n, self._k, self.base_ring())
class F(CombinatorialFreeModule, BindableClass):
'\n The natural basis of the truncated Fock space.\n\n This is the natural basis of the full Fock space projected\n onto the truncated Fock space. It inherits the\n `U_q(\\widehat{\\widetilde{sl}}_n)`-action from the action\n on the full Fock space.\n\n EXAMPLES::\n\n sage: FS = FockSpace(4)\n sage: F = FS.natural()\n sage: FS3 = FockSpace(4, truncated=3)\n sage: F3 = FS3.natural()\n sage: u = F.highest_weight_vector()\n sage: u3 = F3.highest_weight_vector()\n\n sage: u3.f(0,3,2,1)\n |2, 1, 1>\n sage: u.f(0,3,2,1)\n |2, 1, 1> + q*|1, 1, 1, 1>\n\n sage: u.f(0,3,2,1,1)\n ((q^2+1)/q)*|2, 1, 1, 1>\n sage: u3.f(0,3,2,1,1)\n 0\n '
def __init__(self, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2, truncated=3).natural()\n sage: TestSuite(F).run() # long time\n '
self._basis_name = 'natural'
if (len(F._multicharge) == 1):
self._above = (lambda x, y: (x[0] < y[0]))
else:
self._above = (lambda x, y: ((x[0] < y[0]) or ((x[0] == y[0]) and (x[1] < y[1]))))
self._addable = (lambda la, i: [x for x in la.outside_corners() if (la.content(*x, multicharge=F._multicharge) == i)])
self._removable = (lambda la, i: [x for x in la.corners() if (la.content(*x, multicharge=F._multicharge) == i)])
indices = Partitions(F._n, max_length=F._k)
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='', bracket=['|', '>'], latex_bracket=['\\lvert', '\\rangle'], sorting_reverse=True, category=FockSpaceBases(F))
options = FockSpaceOptions
def _repr_term(self, m):
"\n Return a representation of the monomial indexed by ``m``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2, truncated=3).natural()\n sage: F._repr_term(Partition([2,1,1]))\n '|2, 1, 1>'\n sage: F.highest_weight_vector()\n |>\n "
return (('|' + repr(m)[1:(- 1)]) + '>')
class Element(FockSpace.natural.Element):
'\n An element in the truncated Fock space.\n '
def _f(self, i):
'\n Apply the action of `f_i` on ``self``.\n\n EXAMPLES::\n\n sage: F = FockSpace(2, truncated=3).natural()\n sage: mg = F.highest_weight_vector()\n sage: mg.f(0)\n |1>\n sage: mg.f(0,1)\n |2> + q*|1, 1>\n sage: mg.f(0,1,0)\n |3> + q*|1, 1, 1>\n sage: mg.f(0,1,0,0)\n 0\n sage: mg.f(0,1,0,1)\n |4> + q*|3, 1> + q*|2, 1, 1>\n sage: mg.f(0,1,0,1,0)\n |5> + |3, 2> + 2*q*|3, 1, 1> + q^2*|2, 2, 1>\n '
P = self.parent()
def N_right(la, x, i):
return (sum((1 for y in P._addable(la, i) if P._above(y, x))) - sum((1 for y in P._removable(la, i) if P._above(y, x))))
q = P.realization_of()._q
k = P.realization_of()._k
return P.sum_of_terms([(la.add_cell(*x), (c * (q ** N_right(la, x, i)))) for (la, c) in self for x in P._addable(la, i) if (x[0] < k)])
natural = F
class A(CombinatorialFreeModule, BindableClass):
"\n The `A` basis of the Fock space, which is the approximation\n basis of the lower global crystal basis.\n\n INPUT:\n\n - ``algorithm`` -- (default ``'GW'``) the algorithm to use when\n computing this basis in the Fock space; the possible values are:\n\n * ``'GW'`` -- use the algorithm given by Goodman and Wenzl\n in [GW1999]_\n * ``'LLT'`` -- use the LLT algorithm given in [LLT1996]_\n\n .. NOTE::\n\n The bases produced by the two algorithms are not the same\n in general.\n\n EXAMPLES::\n\n sage: FS = FockSpace(5, truncated=4)\n sage: F = FS.natural()\n sage: A = FS.A()\n\n We demonstrate that they are different bases, but both algorithms\n still compute the basis `G`::\n\n sage: A2 = FS.A('LLT')\n sage: G = FS.G()\n sage: F(A[12,9])\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+1)*|8, 8, 4, 1>\n sage: F(A2[12,9])\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+2)*|8, 8, 4, 1>\n sage: G._G_to_fock_basis(Partition([12,9]), 'GW')\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + q^2*|8, 8, 4, 1>\n sage: G._G_to_fock_basis(Partition([12,9]), 'LLT')\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + q^2*|8, 8, 4, 1>\n "
def __init__(self, F, algorithm='GW'):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2, truncated=3)\n sage: A = FS.A()\n sage: TestSuite(A).run()\n sage: A2 = FS.A('LLT')\n sage: TestSuite(A2).run()\n "
self._basis_name = 'approximation'
if (algorithm not in ['GW', 'LLT']):
raise ValueError('invalid algorithm')
self._alg = algorithm
indices = RegularPartitions_truncated(F._n, F._k)
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='A', bracket=False, sorting_reverse=True, category=FockSpaceBases(F))
self.module_morphism(self._A_to_fock_basis, triangular='upper', unitriangular=True, codomain=F.natural()).register_as_coercion()
options = FockSpaceOptions
@cached_method
def _LLT(self, la):
'\n Return the result from the regular LLT algorithm on the partition\n ``la`` to compute the `A`-basis element in the corresponding\n Fock space.\n\n EXAMPLES::\n\n sage: FS = FockSpace(5, truncated=4)\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: F(A[12,9])\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+1)*|8, 8, 4, 1>\n sage: A._LLT(Partition([12,9]))\n |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+2)*|8, 8, 4, 1>\n '
R = self.realization_of()
fock = R.natural()
k = R._k
cur = fock.highest_weight_vector()
corners = la.corners()
cells = set(la.cells())
q = R._q
k = (R._n - 1)
r = R._multicharge[0]
b = ZZ.zero()
while any(((((c[1] * k) + c[0]) >= b) for c in corners)):
power = 0
i = ((- b) + r)
for x in range(((b // k) + 1)):
if (((b - (x * k)), x) in cells):
power += 1
cur = cur.f(i)
cur /= q_factorial(power, q)
b += 1
return cur
def _skew_tableau(self, cur, nu, d):
'\n Return the action of the skew tableaux formed from ``nu`` by\n applying the ``d`` fundamental weights.\n\n EXAMPLES::\n\n sage: FS = FockSpace(3, truncated=3)\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: G = FS.G()\n sage: sk = A._skew_tableau(F(G[6,3]), Partition([6,3]), [1,1]); sk\n |8, 4> + q*|8, 2, 2> + q*|7, 4, 1> + q^2*|7, 3, 2> + q*|6, 6>\n + q^2*|6, 5, 1> + q^2*|5, 4, 3> + q^3*|4, 4, 4>\n sage: sk == F(A[8,4])\n True\n '
R = self.realization_of()
last = None
power = 0
q = R._q
for i in reversed(range(len(d))):
for dummy in range(d[i]):
for j in range((i + 1)):
col = (nu[j] if (j < len(nu)) else 0)
res = nu.content(j, col, multicharge=R._multicharge)
if (res != last):
cur /= q_factorial(power, q)
power = 1
last = res
else:
power += 1
cur = cur.f(res)
nu = nu.add_cell(j, col)
return (cur / q_factorial(power, q))
@cached_method
def _A_to_fock_basis(self, la):
'\n Return the `A` basis indexed by ``la`` in the natural basis.\n\n EXAMPLES::\n\n sage: FS = FockSpace(2, truncated=3)\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: A._A_to_fock_basis(Partition([2,1]))\n |2, 1>\n sage: F(A[3,1])\n |3, 1> + q*|2, 2> + q^2*|2, 1, 1>\n sage: A._A_to_fock_basis(Partition([3]))\n |3> + q*|1, 1, 1>\n\n sage: FS = FockSpace(2, truncated=5)\n sage: F = FS.natural()\n sage: A = FS.A()\n sage: F(A[7,4,3])\n |7, 4, 3> + q*|7, 4, 1, 1, 1> + q^2*|7, 2, 2, 2, 1> + |5, 4, 3, 2>\n + 2*q*|5, 4, 3, 1, 1> + 2*q^2*|5, 4, 2, 2, 1>\n + 2*q^3*|5, 3, 3, 2, 1> + q^4*|4, 4, 3, 2, 1>\n sage: F(A[7,4,3,2])\n |7, 4, 3, 2> + q*|7, 4, 3, 1, 1> + q^2*|7, 4, 2, 2, 1>\n + q^3*|7, 3, 3, 2, 1> + q^4*|6, 4, 3, 2, 1>\n '
if (self._alg == 'LLT'):
return self._LLT(la)
fock = self.realization_of().natural()
k = self.realization_of()._k
if (la.size() == 0):
return fock.highest_weight_vector()
if (len(la) == k):
G = self.realization_of().G()
return G._G_to_fock_basis(la)
n = self.realization_of()._n
if ((len(la) == (k - 1)) and all((((((la[i] - la[(i + 1)]) + 1) % n) == 0) for i in range((k - 2)))) and (((la[(- 1)] + 1) % n) == 0)):
return fock.monomial(la)
shifted = [(la[i] - ((n - 1) * ((k - 1) - i))) for i in range(len(la))]
if ((len(la) == (k - 1)) and (shifted in _Partitions)):
d = [(((la[i] - la[(i + 1)]) + 1) % n) for i in range((len(la) - 1))]
d.append(((la[(- 1)] + 1) % n))
crit = list(la)
for (i, d_i) in enumerate(d):
for j in range((i + 1)):
crit[j] -= d_i
nu = fock._indices(crit)
return self._skew_tableau(fock.monomial(nu), nu, d)
a = (list(la) + ([0] * ((k - 1) - len(la))))
a = [(a[i] + ((k - 1) - i)) for i in range((k - 1))]
d = [((a[i] - a[(i + 1)]) % n) for i in range((k - 2))]
d.append((a[(- 1)] % n))
for (i, d_i) in enumerate(d):
for j in range((i + 1)):
a[j] -= d_i
if (sum(a) == 0):
return self._LLT(la)
p = list(a)
for i in range((k - 2)):
if ((a[i] - a[(i + 1)]) == 0):
d[i] -= 1
for j in range((i + 1)):
p[j] += 1
if (a[(- 1)] == 0):
d[(- 1)] -= 1
for j in range((k - 1)):
p[j] += 1
p = [(p[i] - ((k - 1) - i)) for i in range((k - 1))]
I = self._indices
nu = I(p)
while (not (max(nu.to_exp()) < n)):
while (d[(- 1)] == 0):
d.pop()
for j in range(d[(- 1)]):
p[j] += 1
nu = I(p)
if (la == nu):
j = (- 1)
for i in range((k - 2)):
if ((p[i] - p[(i + 1)]) == 0):
j = (- 2)
break
if ((p[i] > n) and ((p[i] - p[(i + 1)]) > n)):
j = i
if ((j != (- 2)) and (p[(- 1)] > n)):
j = (k - 1)
if (j < 0):
return self._LLT(la)
G = self.realization_of().G()
nu = I([((p[i] - n) if (i <= j) else p[i]) for i in range((k - 1))])
d = (([0] * j) + [n])
return self._skew_tableau(G._G_to_fock_basis(nu), nu, d)
G = self.realization_of().G()
return self._skew_tableau(G._G_to_fock_basis(nu), nu, d)
approximation = A
class G(CombinatorialFreeModule, BindableClass):
'\n The lower global crystal basis living inside of a\n truncated Fock space.\n\n EXAMPLES::\n\n sage: FS = FockSpace(4, truncated=2)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[3,1])\n |3, 1>\n sage: F(G[6,2])\n |6, 2> + q*|5, 3>\n sage: F(G[14])\n |14> + q*|11, 3>\n\n sage: FS = FockSpace(3, truncated=4)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[4,1])\n |4, 1> + q*|3, 2>\n sage: F(G[4,2,2])\n |4, 2, 2> + q*|3, 2, 2, 1>\n\n We check against the tables in [LLT1996]_ (after truncating)::\n\n sage: FS = FockSpace(3, truncated=3)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[10])\n |10> + q*|8, 2> + q*|7, 2, 1>\n sage: F(G[6,4])\n |6, 4> + q*|6, 2, 2> + q^2*|4, 4, 2>\n sage: F(G[5,5])\n |5, 5> + q*|4, 3, 3>\n\n sage: FS = FockSpace(4, truncated=3)\n sage: F = FS.natural()\n sage: G = FS.G()\n sage: F(G[3,3,1])\n |3, 3, 1>\n sage: F(G[3,2,2])\n |3, 2, 2>\n sage: F(G[7])\n |7> + q*|3, 3, 1>\n '
def __init__(self, F):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: G = FockSpace(2, truncated=3).G()\n sage: TestSuite(G).run()\n sage: G = FockSpace(4, truncated=3).G()\n sage: TestSuite(G).run()\n '
self._basis_name = 'lower global crystal'
indices = RegularPartitions_truncated(F._n, F._k)
CombinatorialFreeModule.__init__(self, F.base_ring(), indices, prefix='G', bracket=False, sorting_reverse=True, category=FockSpaceBases(F))
self.module_morphism(self._G_to_fock_basis, triangular='upper', unitriangular=True, codomain=F.natural()).register_as_coercion()
options = FockSpaceOptions
@cached_method
def _G_to_fock_basis(self, la, algorithm='GW'):
"\n Return the `G` basis indexed by ``la`` in the natural basis.\n\n EXAMPLES::\n\n sage: G = FockSpace(3, truncated=3).G()\n sage: G._G_to_fock_basis(Partition([3]))\n |3> + q*|2, 1>\n sage: G._G_to_fock_basis(Partition([2,1]))\n |2, 1> + q*|1, 1, 1>\n sage: G._G_to_fock_basis(Partition([2,1]), 'LLT')\n |2, 1> + q*|1, 1, 1>\n "
fock = self.realization_of().natural()
if (la.size() == 0):
return fock.highest_weight_vector()
if (algorithm == 'GW'):
n = self.realization_of()._n
k = self.realization_of()._k
if (len(la) == k):
x = la[(- 1)]
mu = _Partitions([(p - x) for p in la])
def add_cols(nu):
return _Partitions([(v + x) for v in (list(nu) + ([0] * (k - len(nu))))])
return fock.sum_of_terms(((add_cols(nu), c) for (nu, c) in self._G_to_fock_basis(mu)))
n = self.realization_of()._n
if ((len(la) == (k - 1)) and all((((((la[i] - la[(i + 1)]) + 1) % n) == 0) for i in range((k - 2)))) and (((la[(- 1)] + 1) % n) == 0)):
return fock.monomial(la)
cur = self.realization_of().A(algorithm)._A_to_fock_basis(la)
s = sorted(cur.support())
s.pop()
q = self.realization_of()._q
while s:
mu = s.pop()
d = cur[mu].denominator()
k = d.degree()
n = cur[mu].numerator()
if ((k != 0) or (n.constant_coefficient() != 0)):
gamma = sum(((n[i] * ((q ** (i - k)) + (q ** (k - i)))) for i in range(min(n.degree(), k))))
gamma += n[k]
cur -= (gamma * self._G_to_fock_basis(mu, algorithm))
for x in cur.support():
if ((x == mu) or (not mu.dominates(x))):
continue
for i in reversed(range(len(s))):
if (not s[i].dominates(x)):
s.insert((i + 1), x)
break
return cur
lower_global_crystal = G
canonical = G
|
def q_int(n, q=None):
'\n Return the `q`-analog of the nonnegative integer `n`.\n\n The `q`-analog of the nonnegative integer `n` is given by\n\n .. MATH::\n\n [n]_q = \\frac{q^n - q^{-n}}{q - q^{-1}}\n = q^{n-1} + q^{n-3} + \\cdots + q^{-n+3} + q^{-n+1}.\n\n INPUT:\n\n - ``n`` -- the nonnegative integer `n` defined above\n - ``q`` -- (default: `q \\in \\ZZ[q, q^{-1}]`) the parameter `q`\n (should be invertible)\n\n If ``q`` is unspecified, then it defaults to using the generator `q`\n for a Laurent polynomial ring over the integers.\n\n .. NOTE::\n\n This is not the "usual" `q`-analog of `n` (or `q`-integer) but\n a variant useful for quantum groups. For the version used in\n combinatorics, see :mod:`sage.combinat.q_analogues`.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_int\n sage: q_int(2)\n q^-1 + q\n sage: q_int(3)\n q^-2 + 1 + q^2\n sage: q_int(5)\n q^-4 + q^-2 + 1 + q^2 + q^4\n sage: q_int(5, 1)\n 5\n\n TESTS::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_int\n sage: q_int(1)\n 1\n sage: q_int(0)\n 0\n '
if (q is None):
R = LaurentPolynomialRing(ZZ, 'q')
q = R.gen()
else:
R = q.parent()
if (n == 0):
return R.zero()
return R.sum(((q ** ((n - (2 * i)) - 1)) for i in range(n)))
|
def q_factorial(n, q=None):
'\n Return the `q`-analog of the factorial `n!`.\n\n The `q`-factorial is defined by:\n\n .. MATH::\n\n [n]_q! = [n]_q \\cdot [n-1]_q \\cdots [2]_q \\cdot [1]_q,\n\n where `[n]_q` denotes the `q`-integer defined in\n :func:`sage.algebras.quantum_groups.q_numbers.q_int()`.\n\n INPUT:\n\n - ``n`` -- the nonnegative integer `n` defined above\n - ``q`` -- (default: `q \\in \\ZZ[q, q^{-1}]`) the parameter `q`\n (should be invertible)\n\n If ``q`` is unspecified, then it defaults to using the generator `q`\n for a Laurent polynomial ring over the integers.\n\n .. NOTE::\n\n This is not the "usual" `q`-factorial but a variant\n useful for quantum groups. For the version used in\n combinatorics, see :mod:`sage.combinat.q_analogues`.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_factorial\n sage: q_factorial(3)\n q^-3 + 2*q^-1 + 2*q + q^3\n sage: p = LaurentPolynomialRing(QQ, \'q\').gen()\n sage: q_factorial(3, p)\n q^-3 + 2*q^-1 + 2*q + q^3\n sage: p = ZZ[\'p\'].gen()\n sage: q_factorial(3, p)\n (p^6 + 2*p^4 + 2*p^2 + 1)/p^3\n\n The `q`-analog of `n!` is only defined for `n` a nonnegative\n integer (:trac:`11411`)::\n\n sage: q_factorial(-2)\n Traceback (most recent call last):\n ...\n ValueError: argument (-2) must be a nonnegative integer\n '
if ((n in ZZ) and (n >= 0)):
return prod((q_int(i, q) for i in range(1, (n + 1))))
raise ValueError('argument ({}) must be a nonnegative integer'.format(n))
|
def q_binomial(n, k, q=None):
'\n Return the `q`-binomial coefficient.\n\n Let `[n]_q!` denote the `q`-factorial of `n` given by\n :meth:`sage.algebras.quantum_groups.q_numbers.q_factorial()`.\n The `q`-binomial coefficient is defined by\n\n .. MATH::\n\n \\begin{bmatrix} n \\\\ k \\end{bmatrix}_q\n = \\frac{[n]_q!}{[n-k]_q! \\cdot [k]_q!}.\n\n INPUT:\n\n - ``n, k`` -- the nonnegative integers `n` and `k` defined above\n - ``q`` -- (default: `q \\in \\ZZ[q, q^{-1}]`) the parameter `q`\n (should be invertible)\n\n If ``q`` is unspecified, then it is taken to be the generator `q` for\n a Laurent polynomial ring over the integers.\n\n .. NOTE::\n\n This is not the "usual" `q`-binomial but a variant\n useful for quantum groups. For the version used in\n combinatorics, see :mod:`sage.combinat.q_analogues`.\n\n .. WARNING::\n\n This method uses division by `q`-factorials.\n If `[k]_q!` or `[n-k]_q!` are zero-divisors, or\n division is not implemented in the ring containing `q`,\n then it will not work.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_binomial\n sage: q_binomial(2, 1)\n q^-1 + q\n sage: q_binomial(2, 0)\n 1\n sage: q_binomial(4, 1)\n q^-3 + q^-1 + q + q^3\n sage: q_binomial(4, 3)\n q^-3 + q^-1 + q + q^3\n\n TESTS::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_binomial\n sage: all(q_binomial(n, k, 1) == binomial(n, k) for n in range(7) for k in range(n+1))\n True\n sage: q_binomial(-2, 1)\n Traceback (most recent call last):\n ...\n ValueError: n must be nonnegative\n '
if (not ((n in ZZ) and (k in ZZ))):
raise ValueError('arguments ({}, {}) must be integers'.format(n, k))
if (n < 0):
raise ValueError('n must be nonnegative')
if (not ((0 <= k) and (k <= n))):
return 0
k = min((n - k), k)
denomin = (q_factorial((n - k), q) * q_factorial(k, q))
numerat = q_factorial(n, q)
try:
return (numerat // denomin)
except TypeError:
return (numerat / denomin)
|
class QuaGroupModuleElement(Element):
'\n Base class for elements created using QuaGroup.\n '
def __init__(self, parent, libgap_elt):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: TestSuite(Q.an_element()).run()\n "
self._libgap = libgap(libgap_elt)
Element.__init__(self, parent)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: Q.an_element()\n 1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ] + K1\n + (-q^-1 + q^-3)*K1[ K1 ; 1 ]\n\n sage: Q = QuantumGroup(['D',4])\n sage: Q.F_simple()\n Finite family {1: F[a1], 2: F[a2], 3: F[a3], 4: F[a4]}\n "
c = re.compile('\\+(?! [^(]* \\))')
ret = re.sub(c, ' + ', repr(self._libgap))
for (i, al) in reversed(list(enumerate(self.parent()._pos_roots))):
short = '+'.join(((('%s*a%s' % (coeff, index)) if (coeff != 1) else ('a%s' % index)) for (index, coeff) in al))
ret = ret.replace(('F%s' % (i + 1)), ('F[%s]' % short))
ret = ret.replace(('E%s' % (i + 1)), ('E[%s]' % short))
return ret
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: latex(Q.an_element())\n 1+{(q)} F_{\\alpha_{1}}+E_{\\alpha_{1}}+{(q^{2}-1-q^{-2}+q^{-4})}\n [ K_{1} ; 2 ]+K_{1}+{(-q^{-1}+q^{-3})} K_{1}[ K_{1} ; 1 ]\n\n sage: Q = QuantumGroup(['D',4])\n sage: latex(list(Q.F_simple()))\n \\left[F_{\\alpha_{1}}, F_{\\alpha_{2}},\n F_{\\alpha_{3}}, F_{\\alpha_{4}}\\right]\n "
from sage.misc.latex import latex
ret = repr(self._libgap)
for (i, al) in reversed(list(enumerate(self.parent()._pos_roots))):
ret = ret.replace(('F%s' % (i + 1)), ('F_{%s}' % latex(al)))
ret = ret.replace(('E%s' % (i + 1)), ('E_{%s}' % latex(al)))
for (i, ii) in reversed(list(enumerate(self.parent()._cartan_type.index_set()))):
ret = ret.replace(('K%s' % (i + 1)), ('K_{%s}' % ii))
ret = ret.replace('(', '{(')
ret = ret.replace(')', ')}')
ret = ret.replace('v0', 'v_0')
ret = ret.replace('*', ' ')
c = re.compile('q\\^-?[0-9]*')
for m in reversed(list(c.finditer(ret))):
ret = ((((ret[:(m.start() + 2)] + '{') + ret[(m.start() + 2):m.end()]) + '}') + ret[m.end():])
return ret
def __reduce__(self):
"\n Used in pickling.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: x = Q.an_element()\n sage: loads(dumps(x)) == x\n True\n "
data = self._libgap.ExtRepOfObj()
R = self.base_ring()
ret = []
for i in range((len(data) // 2)):
ret.append(data[(2 * i)].sage())
ret.append(R(str(data[((2 * i) + 1)])))
return (_unpickle_generic_element, (self.parent(), ret))
def __hash__(self):
"\n Return the hash of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',3])\n sage: x = Q.an_element()\n sage: hash(x) == hash(x.gap())\n True\n "
return hash(self._libgap)
def _richcmp_(self, other, op):
"\n Rich comparison of ``self`` and ``other`` by ``op``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: x = Q.an_element()\n sage: F1, F12, F2 = Q.F()\n sage: q = Q.q()\n sage: x == F1\n False\n sage: x != F1\n True\n sage: F2 * F1\n (q)*F[a1]*F[a2] + F[a1+a2]\n sage: F2 * F1 == q * F1 * F2 + F12\n True\n "
return richcmp(self._libgap, other._libgap, op)
def gap(self):
"\n Return the gap representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',3])\n sage: x = Q.an_element()\n sage: x.gap()\n 1+(q)*F1+E1+(q^4-1-q^-4+q^-8)*[ K1 ; 2 ]+K1+(-q^-2+q^-6)*K1[ K1 ; 1 ]\n "
return self._libgap
_libgap_ = _gap_ = gap
def _add_(self, other):
"\n Add ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: F1, F2 = Q.F_simple()\n sage: F1 * F2 + F2 * F1\n (q^3 + 1)*F[a1]*F[a2] + F[a1+a2]\n "
return self.__class__(self.parent(), (self._libgap + other._libgap))
def _sub_(self, other):
"\n Subtract ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: F1, F2 = Q.F_simple()\n sage: F1 * F2 - F2 * F1\n (-q^3 + 1)*F[a1]*F[a2] + (-1)*F[a1+a2]\n "
return self.__class__(self.parent(), (self._libgap - other._libgap))
def _acted_upon_(self, scalar, self_on_left=True):
"\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: q = Q.q()\n sage: x = Q.one().f_tilde([1,2,1,1,2,2]); x\n F[a1+a2]^(3)\n sage: 3 * x\n (3)*F[a1+a2]^(3)\n sage: x * (5/3)\n (5/3)*F[a1+a2]^(3)\n sage: q^-10 * x\n (q^-10)*F[a1+a2]^(3)\n sage: (1 + q^2 - q^-1) * x\n (q^2 + 1-q^-1)*F[a1+a2]^(3)\n "
try:
scalar = self.parent().base_ring()(scalar)
scalar = scalar.subs(q=self.parent()._libgap_q)
except (TypeError, ValueError):
return None
return self.__class__(self.parent(), (self._libgap * libgap(scalar)))
def e_tilde(self, i):
"\n Return the action of the Kashiwara operator\n `\\widetilde{e}_i` on ``self``.\n\n INPUT:\n\n - ``i`` -- an element of the index set or a list to\n perform a string of operators\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: x = Q.one().f_tilde([1,2,1,1,2,2])\n sage: x.e_tilde([2,2,1,2])\n F[a1]^(2)\n "
if isinstance(i, (list, tuple)):
ret = self
for j in i:
if (not ret):
return ret
ret = ret._et(j)
return ret
return self._et(i)
def f_tilde(self, i):
"\n Return the action of the Kashiwara operator\n `\\widetilde{f}_i` on ``self``.\n\n INPUT:\n\n - ``i`` -- an element of the index set or a list to\n perform a string of operators\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: Q.one().f_tilde(1)\n F[a1]\n sage: Q.one().f_tilde(2)\n F[a2]\n sage: Q.one().f_tilde([1,2,1,1,2])\n F[a1]*F[a1+a2]^(2)\n "
if isinstance(i, (list, tuple)):
ret = self
for j in i:
if (not ret):
return ret
ret = ret._ft(j)
return ret
return self._ft(i)
|
class QuantumGroup(UniqueRepresentation, Parent):
"\n A Drinfel'd-Jimbo quantum group (implemented using the optional GAP\n package ``QuaGroup``).\n\n EXAMPLES:\n\n We check the quantum Serre relations. We first we import the\n `q`-binomial using the `q`-int for quantum groups::\n\n sage: from sage.algebras.quantum_groups.q_numbers import q_binomial\n\n We verify the Serre relations for type `A_2`::\n\n sage: Q = algebras.QuantumGroup(['A',2])\n sage: F1,F12,F2 = Q.F()\n sage: q = Q.q()\n sage: F1^2*F2 - q_binomial(2,1,q) * F1*F2*F1 + F2*F1^2\n 0\n\n We verify the Serre relations for type `B_2`::\n\n sage: Q = algebras.QuantumGroup(['B',2])\n sage: F1, F12, F122, F2 = Q.F()\n sage: F1^2*F2 - q_binomial(2,1,q^2) * F1*F2*F1 + F2*F1^2\n 0\n sage: (F2^3*F1 - q_binomial(3,1,q) * F2^2*F1*F2\n ....: + q_binomial(3,2,q) * F2*F1*F2^2 - F1*F2^3)\n 0\n\n REFERENCES:\n\n - :wikipedia:`Quantum_group`\n "
@staticmethod
def __classcall_private__(cls, cartan_type, q=None):
"\n Initialize ``self``.\n\n TESTS::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q is QuantumGroup('A2', None)\n True\n "
cartan_type = CartanType(cartan_type)
return super().__classcall__(cls, cartan_type, q)
def __init__(self, cartan_type, q):
"\n Initialize ``self``.\n\n TESTS::\n\n sage: Q = QuantumGroup(['A',2])\n sage: TestSuite(Q).run() # long time\n\n sage: Q = QuantumGroup(['G',2])\n sage: TestSuite(Q).run() # long time\n "
self._cartan_type = cartan_type
GapPackage('QuaGroup', spkg='gap_package_quagroup').require()
libgap.LoadPackage('QuaGroup')
R = libgap.eval(('RootSystem("%s",%s)' % (cartan_type.type(), cartan_type.rank())))
Q = self._cartan_type.root_system().root_lattice()
I = cartan_type.index_set()
self._pos_roots = [Q.sum_of_terms([(ii, root[i]) for (i, ii) in enumerate(I) if (root[i] != 0)]) for root in R.PositiveRootsInConvexOrder().sage()]
if (q is None):
self._libgap = R.QuantizedUEA()
self._libgap_q = libgap.eval('_q')
self._libgap_base = libgap.eval('QuantumField')
base_field = QQ['q'].fraction_field()
q = base_field.gen()
else:
base_field = q.parent()
self._libgap = R.QuantizedUEA(base_field, q)
self._libgap_base = libgap(base_field)
self._libgap_q = libgap(q)
self._q = q
Parent.__init__(self, base=base_field, category=HopfAlgebras(Fields()))
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: QuantumGroup(['A',2])\n Quantum Group of type ['A', 2] with q=q\n "
return 'Quantum Group of type {} with q={}'.format(self._cartan_type, self._q)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(QuantumGroup(['A',3]))\n U_{q}(A_{3})\n sage: zeta3 = CyclotomicField(3).gen()\n sage: latex(QuantumGroup(['G',2], q=zeta3))\n U_{\\zeta_{3}}(G_2)\n "
from sage.misc.latex import latex
return ('U_{%s}(%s)' % (latex(self._q), latex(self._cartan_type)))
def gap(self):
"\n Return the gap representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.gap()\n QuantumUEA( <root system of type A2>, Qpar = q )\n "
return self._libgap
_libgap_ = _gap_ = gap
def cartan_type(self):
"\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.cartan_type()\n ['A', 2]\n "
return self._cartan_type
def _element_constructor_(self, elt):
"\n Construct an element of ``self`` from ``elt``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q(0)\n 0\n sage: Q(4)\n (4)*1\n sage: Q(4).parent() is Q\n True\n sage: Q(Q.q()).parent() is Q\n True\n sage: Q(Q.an_element()) == Q.an_element()\n True\n "
if (not elt):
return self.zero()
if (elt in self.base_ring()):
return (elt * self.one())
return self.element_class(self, elt)
@cached_method
def one(self):
"\n Return the multiplicative identity of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.one()\n 1\n "
return self.element_class(self, self._libgap.One())
@cached_method
def zero(self):
"\n Return the multiplicative identity of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.zero()\n 0\n "
return self.element_class(self, self._libgap.ZeroImmutable())
@cached_method
def gens(self):
"\n Return the generators of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.gens()\n (F[a1], F[a1+a2], F[a2],\n K1, (-q + q^-1)*[ K1 ; 1 ] + K1,\n K2, (-q + q^-1)*[ K2 ; 1 ] + K2,\n E[a1], E[a1+a2], E[a2])\n "
return tuple([self.element_class(self, gen) for gen in self._libgap.GeneratorsOfAlgebra()])
def E(self):
"\n Return the family of generators `\\{E_{\\alpha}\\}_{\\alpha \\in \\Phi}`,\n where `\\Phi` is the root system of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: list(Q.E())\n [E[a1], E[a1+a2], E[a1+2*a2], E[a2]]\n "
N = (len(self._pos_roots) + (len(self._cartan_type.index_set()) * 2))
d = {al: self.gens()[(N + i)] for (i, al) in enumerate(self._pos_roots)}
return Family(self._pos_roots, d.__getitem__)
def E_simple(self):
"\n Return the family of generators `\\{E_i := E_{\\alpha_i}\\}_{i \\in I}`.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: Q.E_simple()\n Finite family {1: E[a1], 2: E[a2]}\n "
I = self._cartan_type.index_set()
gens = self.algebra_generators()
d = {i: gens[('E%s' % i)] for i in I}
return Family(I, d.__getitem__)
def F(self):
"\n Return the family of generators `\\{F_{\\alpha}\\}_{\\alpha \\in \\Phi}`,\n where `\\Phi` is the root system of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: list(Q.F())\n [F[a1], F[3*a1+a2], F[2*a1+a2], F[3*a1+2*a2], F[a1+a2], F[a2]]\n "
d = {al: self.gens()[i] for (i, al) in enumerate(self._pos_roots)}
return Family(self._pos_roots, d.__getitem__)
def F_simple(self):
"\n Return the family of generators `\\{F_i := F_{\\alpha_i}\\}_{i \\in I}`.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: Q.F_simple()\n Finite family {1: F[a1], 2: F[a2]}\n "
I = self._cartan_type.index_set()
gens = self.algebra_generators()
d = {i: gens[('F%s' % i)] for i in I}
return Family(I, d.__getitem__)
def K(self):
"\n Return the family of generators `\\{K_i\\}_{i \\in I}`.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',3])\n sage: Q.K()\n Finite family {1: K1, 2: K2, 3: K3}\n sage: Q.K_inverse()\n Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,\n 2: (-q + q^-1)*[ K2 ; 1 ] + K2,\n 3: (-q + q^-1)*[ K3 ; 1 ] + K3}\n "
N = len(self._pos_roots)
I = self._cartan_type.index_set()
d = {ii: self.gens()[(N + (2 * i))] for (i, ii) in enumerate(I)}
return Family(I, d.__getitem__)
def K_inverse(self):
"\n Return the family of generators `\\{K_i^{-1}\\}_{i \\in I}`.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',3])\n sage: Q.K_inverse()\n Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,\n 2: (-q + q^-1)*[ K2 ; 1 ] + K2,\n 3: (-q + q^-1)*[ K3 ; 1 ] + K3}\n "
N = len(self._pos_roots)
I = self._cartan_type.index_set()
d = {ii: self.gens()[((N + (2 * i)) + 1)] for (i, ii) in enumerate(I)}
return Family(I, d.__getitem__)
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: list(Q.algebra_generators())\n [F[a1], F[a2],\n K1, K2,\n (-q + q^-1)*[ K1 ; 1 ] + K1, (-q + q^-1)*[ K2 ; 1 ] + K2,\n E[a1], E[a2]]\n "
I = self._cartan_type.index_set()
simples = self._cartan_type.root_system().root_lattice().simple_roots()
ret = {}
for (i, al) in enumerate(simples):
ii = I[i]
ret[('F%s' % ii)] = self.F()[al]
ret[('K%s' % ii)] = self.K()[ii]
ret[('Ki%s' % ii)] = self.K_inverse()[ii]
ret[('E%s' % ii)] = self.E()[al]
keys = ((([('F%s' % i) for i in I] + [('K%s' % i) for i in I]) + [('Ki%s' % i) for i in I]) + [('E%s' % i) for i in I])
return Family(keys, ret.__getitem__)
def _an_element_(self):
"\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.an_element()\n 1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]\n + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ]\n "
i = self._cartan_type.index_set()[0]
al = self._cartan_type.root_system().root_lattice().simple_root(i)
return (((self.E()[al] + self.K()[i]) + (self.K_inverse()[i] ** 2)) + (self.q() * self.F()[al]))
def some_elements(self):
"\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: Q.some_elements()\n [1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]\n + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ],\n K1, F[a1], E[a1]]\n "
return ((([self.an_element()] + list(self.K())) + list(self.F_simple())) + list(self.E_simple()))
def q(self):
"\n Return the parameter `q`.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',3])\n sage: Q.q()\n q\n sage: zeta3 = CyclotomicField(3).gen()\n sage: Q = QuantumGroup(['B',2], q=zeta3)\n sage: Q.q()\n zeta3\n "
return self._q
def _Hom_(self, Y, category):
"\n Return the highest weight module of weight ``weight`` of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: H = Hom(Q, B); H\n Set of Morphisms from Quantum Group of type ['A', 2] with q=q to\n Lower Half of Quantum Group of type ['A', 2] with q=q in Category of rings\n sage: type(H)\n <class '...QuantumGroupHomset_with_category_with_equality_by_id'>\n "
if ((category is not None) and (not category.is_subcategory(Rings()))):
raise TypeError(('%s is not a subcategory of Rings()' % category))
if (Y not in Rings()):
raise TypeError(('%s is not a ring' % Y))
return QuantumGroupHomset(self, Y, category=category)
def highest_weight_module(self, weight):
"\n Return the highest weight module of weight ``weight`` of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.highest_weight_module([1,3])\n Highest weight module of weight Lambda[1] + 3*Lambda[2] of\n Quantum Group of type ['A', 2] with q=q\n "
return HighestWeightModule(self, weight)
def lower_half(self):
"\n Return the lower half of the quantum group ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.lower_half()\n Lower Half of Quantum Group of type ['A', 2] with q=q\n "
return LowerHalfQuantumGroup(self)
def coproduct(self, elt, n=1):
"\n Return the coproduct of ``elt`` (iterated ``n`` times).\n\n The comultiplication `\\Delta \\colon U_q(\\mathfrak{g}) \\to\n U_q(\\mathfrak{g}) \\otimes U_q(\\mathfrak{g})` is defined by\n\n .. MATH::\n\n \\begin{aligned}\n \\Delta(E_i) &= E_i \\otimes 1 + K_i \\otimes E_i, \\\\\n \\Delta(F_i) &= F_i \\otimes K_i^{-1} + 1 \\otimes F_i, \\\\\n \\Delta(K_i) &= K_i \\otimes K_i.\n \\end{aligned}\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: [Q.coproduct(e) for e in Q.E()]\n [1*(E[a1]<x>1) + 1*(K1<x>E[a1]),\n 1*(E[a1+a2]<x>1) + 1*(K1*K2<x>E[a1+a2]) + q^2-q^-2*(K2*E[a1]<x>E[a2]),\n q^4-q^2-1 + q^-2*(E[a1]<x>E[a2]^(2)) + 1*(E[a1+2*a2]<x>1)\n + 1*(K1<x>E[a1+2*a2]) + q-q^-1*(K1*K2[ K2 ; 1 ]<x>E[a1+2*a2])\n + q-q^-1*(K2*E[a1+a2]<x>E[a2]) + q^5-2*q^3\n + 2*q^-1-q^-3*(K2[ K2 ; 1 ]*E[a1]<x>E[a2]^(2)),\n 1*(E[a2]<x>1) + 1*(K2<x>E[a2])]\n sage: [Q.coproduct(f, 2) for f in Q.F_simple()]\n [1*(1<x>1<x>F[a1]) + -q^2 + q^-2*(1<x>F[a1]<x>[ K1 ; 1 ])\n + 1*(1<x>F[a1]<x>K1) + q^4-2 + q^-4*(F[a1]<x>[ K1 ; 1 ]<x>[ K1 ; 1 ])\n + -q^2 + q^-2*(F[a1]<x>[ K1 ; 1 ]<x>K1) + -q^2\n + q^-2*(F[a1]<x>K1<x>[ K1 ; 1 ]) + 1*(F[a1]<x>K1<x>K1),\n 1*(1<x>1<x>F[a2]) + -q + q^-1*(1<x>F[a2]<x>[ K2 ; 1 ])\n + 1*(1<x>F[a2]<x>K2) + q^2-2 + q^-2*(F[a2]<x>[ K2 ; 1 ]<x>[ K2 ; 1 ])\n + -q + q^-1*(F[a2]<x>[ K2 ; 1 ]<x>K2) + -q\n + q^-1*(F[a2]<x>K2<x>[ K2 ; 1 ]) + 1*(F[a2]<x>K2<x>K2)]\n "
D = self._libgap.ComultiplicationMap((n + 1))
return self.element_class(self, libgap.Image(D, elt._libgap))
def antipode(self, elt):
"\n Return the antipode of ``elt``.\n\n The antipode `S \\colon U_q(\\mathfrak{g}) \\to U_q(\\mathfrak{g})`\n is the anti-automorphism defined by\n\n .. MATH::\n\n S(E_i) = -K_i^{-1}E_i, \\qquad\n S(F_i) = -F_iK_i, \\qquad\n S(K_i) = K_i^{-1}.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: [Q.antipode(f) for f in Q.F()]\n [(-1)*F[a1]*K1,\n (-q^6 + q^2)*F[a1]*F[a2]*K1*K2 + (-q^4)*F[a1+a2]*K1*K2,\n (-q^8 + q^6 + q^4-q^2)*F[a1]*F[a2]^(2)*K1\n + (-q^9 + 2*q^7-2*q^3 + q)*F[a1]*F[a2]^(2)*K1*K2[ K2 ; 1 ]\n + (-q^5 + q^3)*F[a1+a2]*F[a2]*K1\n + (-q^6 + 2*q^4-q^2)*F[a1+a2]*F[a2]*K1*K2[ K2 ; 1 ]\n + (-q^4)*F[a1+2*a2]*K1 + (-q^5 + q^3)*F[a1+2*a2]*K1*K2[ K2 ; 1 ],\n (-1)*F[a2]*K2]\n "
S = self._libgap.AntipodeMap()
return self.element_class(self, libgap.Image(S, elt._libgap))
def counit(self, elt):
"\n Return the counit of ``elt``.\n\n The counit `\\varepsilon \\colon U_q(\\mathfrak{g}) \\to \\QQ(q)` is\n defined by\n\n .. MATH::\n\n \\varepsilon(E_i) = \\varepsilon(F_i) = 0, \\qquad\n \\varepsilon(K_i) = 1.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: x = Q.an_element()^2\n sage: Q.counit(x)\n 4\n sage: Q.counit(Q.one())\n 1\n sage: Q.counit(Q.zero())\n 0\n "
R = self.base_ring()
ext_rep = list(elt._libgap.ExtRepOfObj())
constant = R.zero()
for i in range((len(ext_rep) // 2)):
if (ext_rep[(2 * i)].Length() == 0):
ext_rep.pop((2 * i))
constant = R(str(ext_rep.pop((2 * i))))
break
F = libgap.eval('ElementsFamily')(libgap.eval('FamilyObj')(self._libgap))
elt = F.ObjByExtRep(ext_rep)
co = self._libgap.CounitMap()
return (R(str(co(elt))) + constant)
class Element(QuaGroupModuleElement):
def _mul_(self, other):
"\n Multiply ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: F1, F2 = Q.F_simple()\n sage: F1 * F2 * F1 * F2\n F[a1]*F[a1+a2]*F[a2] + (q^7 + q^5 + q + q^-1)*F[a1]^(2)*F[a2]^(2)\n sage: E1, E2 = Q.E_simple()\n sage: F1 * E1\n F[a1]*E[a1]\n sage: E1 * F1\n F[a1]*E[a1] + [ K1 ; 1 ]\n "
return self.__class__(self.parent(), (self._libgap * other._libgap))
def bar(self):
"\n Return the bar involution on ``self``.\n\n The bar involution is defined by\n\n .. MATH::\n\n \\overline{E_i} = E_i, \\qquad\\qquad\n \\overline{F_i} = F_i, \\qquad\\qquad\n \\overline{K_i} = K_i^{-1}.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: [gen.bar() for gen in Q.gens()]\n [F[a1],\n (q-q^-1)*F[a1]*F[a2] + F[a1+a2],\n F[a2],\n (-q + q^-1)*[ K1 ; 1 ] + K1, K1,\n (-q + q^-1)*[ K2 ; 1 ] + K2, K2,\n E[a1],\n (-q^2 + 1)*E[a1]*E[a2] + (q^2)*E[a1+a2],\n E[a2]]\n "
bar = self.parent()._libgap.BarAutomorphism()
return self.__class__(self.parent(), libgap.Image(bar, self._libgap))
def omega(self):
"\n Return the action of the `\\omega` automorphism on ``self``.\n\n The `\\omega` automorphism is defined by\n\n .. MATH::\n\n \\omega(E_i) = F_i, \\qquad\\qquad\n \\omega(F_i) = E_i, \\qquad\\qquad\n \\omega(K_i) = K_i^{-1}.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: [gen.omega() for gen in Q.gens()]\n [E[a1],\n (-q)*E[a1+a2],\n E[a2],\n (-q + q^-1)*[ K1 ; 1 ] + K1,\n K1,\n (-q + q^-1)*[ K2 ; 1 ] + K2,\n K2,\n F[a1],\n (-q^-1)*F[a1+a2],\n F[a2]]\n "
omega = self.parent()._libgap.AutomorphismOmega()
return self.__class__(self.parent(), libgap.Image(omega, self._libgap))
def tau(self):
"\n Return the action of the `\\tau` anti-automorphism on ``self``.\n\n The `\\tau` anti-automorphism is defined by\n\n .. MATH::\n\n \\tau(E_i) = E_i, \\qquad\\qquad\n \\tau(F_i) = F_i, \\qquad\\qquad\n \\tau(K_i) = K_i^{-1}.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: [gen.tau() for gen in Q.gens()]\n [F[a1],\n (-q^2 + 1)*F[a1]*F[a2] + (-q)*F[a1+a2],\n F[a2],\n (-q + q^-1)*[ K1 ; 1 ] + K1,\n K1,\n (-q + q^-1)*[ K2 ; 1 ] + K2,\n K2,\n E[a1],\n (q-q^-1)*E[a1]*E[a2] + (-q)*E[a1+a2],\n E[a2]]\n "
tau = self.parent()._libgap.AntiAutomorphismTau()
return self.__class__(self.parent(), libgap.Image(tau, self._libgap))
def braid_group_action(self, braid):
"\n Return the action of the braid group element ``braid``.\n\n The braid group operator `T_i \\colon U_q(\\mathfrak{g}) \\to\n U_q(\\mathfrak{g})` is defined by\n\n .. MATH::\n\n \\begin{aligned}\n T_i(E_i) &= -F_iK_i, \\\\\n T_i(E_j) &= \\sum_{k=0}^{-a_{ij}} (-1)^k q_i^{-k} E_i^{(-a_{ij}-k)} E_j E_i^{(k)} \\text{ if } i \\neq j,\\\\\n T_i(K_j) &= K_jK_i^{a_{ij}}, \\\\\n T_i(F_i) &= -K_i^{-1}E_i, \\\\\n T_i(F_j) &= \\sum_{k=0}^{-a_{ij}} (-1)^k q_i^{-k} F_i^{(k)} F_j F_i^{(-a_{ij}-k)} \\text{ if } i \\neq j,\n \\end{aligned}\n\n where `a_{ij} = \\langle \\alpha_j, \\alpha_i^\\vee \\rangle` is the\n `(i,j)`-entry of the Cartan matrix associated to `\\mathfrak{g}`.\n\n INPUT:\n\n - ``braid`` -- a reduced word of a braid group element\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: F1 = Q.F_simple()[1]\n sage: F1.braid_group_action([1])\n (q-q^-1)*[ K1 ; 1 ]*E[a1] + (-1)*K1*E[a1]\n sage: F1.braid_group_action([1,2])\n F[a2]\n sage: F1.braid_group_action([2,1])\n (-q^3 + 3*q-3*q^-1 + q^-3)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1]*E[a2]\n + (q^3-2*q + q^-1)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1+a2]\n + (q^2-2 + q^-2)*[ K1 ; 1 ]*K2*E[a1]*E[a2]\n + (-q^2 + 1)*[ K1 ; 1 ]*K2*E[a1+a2]\n + (q^2-2 + q^-2)*K1*[ K2 ; 1 ]*E[a1]*E[a2]\n + (-q^2 + 1)*K1*[ K2 ; 1 ]*E[a1+a2]\n + (-q + q^-1)*K1*K2*E[a1]*E[a2] + (q)*K1*K2*E[a1+a2]\n sage: F1.braid_group_action([1,2,1]) == F1.braid_group_action([2,1,2])\n True\n sage: F1.braid_group_action([]) == F1\n True\n "
if (not braid):
return self
QU = self.parent()._libgap
tau = QU.AntiAutomorphismTau()
ret = QU.IdentityMapping()
for i in braid:
if (i < 0):
i = (- i)
T = QU.AutomorphismTalpha(i)
ret *= ((tau * T) * tau)
else:
ret *= QU.AutomorphismTalpha(i)
return self.__class__(self.parent(), libgap.Image(ret, self._libgap))
def _et(self, i):
"\n Return the action of the Kashiwara operator `\\widetilde{e}_i`\n on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: [(g.e_tilde(1), g.e_tilde(2)) for g in Q.F()]\n [(1, 0), (0, F[a1]^(3)), (0, F[a1]^(2)),\n (0, F[3*a1+a2]), (0, F[a1]), (0, 1)]\n\n TESTS::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.one()._et(1)\n 0\n sage: Q.zero().e_tilde(1)\n 0\n "
if (not self):
return self
ret = self._libgap.Ealpha(i)
if (not ret):
return self.parent().zero()
return self.__class__(self.parent(), ret)
def _ft(self, i):
"\n Return the action of the Kashiwara operator `\\widetilde{f}_i`\n on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: [(g._ft(1), g._ft(2)) for g in Q.F()]\n [(F[a1]^(2), F[a1+a2]),\n (F[a1]*F[3*a1+a2], F[3*a1+2*a2]),\n (F[a1]*F[2*a1+a2], F[a1+a2]^(2)),\n (F[a1]*F[3*a1+2*a2], F[a1+a2]^(3)),\n (F[a1]*F[a1+a2], F[a1+a2]*F[a2]),\n (F[a1]*F[a2], F[a2]^(2))]\n sage: Q.one().f_tilde([1,2,1,1,2,2])\n F[2*a1+a2]*F[a1+a2]*F[a2]\n\n TESTS::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.zero().f_tilde(1)\n 0\n "
if (not self):
return self
ret = self._libgap.Falpha(i)
if (not ret):
return self.parent().zero()
return self.__class__(self.parent(), ret)
|
class QuantumGroupMorphism(Morphism):
'\n A morphism whose domain is a quantum group.\n '
def __init__(self, parent, im_gens, check=True):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup([\'A\',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: TestSuite(phi).run(skip="_test_category")\n '
self._repr_type_str = 'Quantum group homomorphism'
Morphism.__init__(self, parent)
Q = parent.domain()
self._im_gens = tuple(im_gens)
if (check and (len(im_gens) != len(Q.algebra_generators()))):
raise ValueError('number of images must equal the number of generators')
self._libgap = Q._libgap.QEAHomomorphism(parent.codomain(), im_gens)
def __reduce__(self):
"\n For pickling.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: loads(dumps(phi)) == phi\n True\n "
return (self.parent(), (self._im_gens,))
def _call_(self, val):
"\n Return the image of ``val`` under ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: phi(F)\n E[a1]\n sage: phi(E*F)\n F[a1]*E[a1]\n sage: phi(F*E)\n F[a1]*E[a1] + [ K1 ; 1 ]\n sage: phi(E*K)\n (-q + q^-1)*F[a1]*[ K1 ; 1 ] + F[a1]*K1\n sage: phi(F*E) == phi(F) * phi(E)\n True\n "
try:
return self.codomain()(self._libgap.ImageElm(val))
except TypeError:
return self.codomain()(str(self._libgap.ImageElm(val)))
def __richcmp__(self, other, op):
"\n Rich comparison of ``self`` and ``other`` by ``op``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: psi = Q.hom([F, K, Ki, E])\n sage: phi == Q.hom([E, Ki, K, F])\n True\n sage: phi == psi\n False\n sage: psi != Q.hom([F, K, Ki, E])\n False\n sage: phi != psi\n True\n\n sage: QB = QuantumGroup(['B',3])\n sage: QC = QuantumGroup(['C',3])\n sage: x = ZZ.one()\n sage: phi = QB.hom([x]*len(QB.algebra_generators()))\n sage: psi = QC.hom([x]*len(QC.algebra_generators()))\n sage: phi.im_gens() == psi.im_gens()\n True\n sage: phi == psi\n False\n "
if (op == op_EQ):
return ((type(self) is type(other)) and (self.domain() is other.domain()) and (self._im_gens == other._im_gens))
if (op == op_NE):
return (not (self == other))
return NotImplemented
def im_gens(self):
"\n Return the image of the generators under ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: phi.im_gens()\n (E[a1], (-q + q^-1)*[ K1 ; 1 ] + K1, K1, F[a1])\n "
return self._im_gens
def _repr_defn(self):
"\n Used in constructing the string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: F, K, Ki, E = Q.gens()\n sage: phi = Q.hom([E, Ki, K, F])\n sage: print(phi._repr_defn())\n F[a1] |--> E[a1]\n K1 |--> (-q + q^-1)*[ K1 ; 1 ] + K1\n (-q + q^-1)*[ K1 ; 1 ] + K1 |--> K1\n E[a1] |--> F[a1]\n "
return '\n'.join((('%s |--> %s' % (gen, self._im_gens[i])) for (i, gen) in enumerate(self.domain().algebra_generators())))
|
class QuantumGroupHomset(HomsetWithBase):
'\n The homset whose domain is a quantum group.\n '
def __call__(self, im_gens, check=True):
"\n Construct an element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: H = Hom(Q, Q)\n sage: F, K, Ki, E = Q.gens()\n sage: phi = H([E, Ki, K, F]); phi\n Quantum group homomorphism endomorphism of Quantum Group of type ['A', 1] with q=q\n Defn: F[a1] |--> E[a1]\n K1 |--> (-q + q^-1)*[ K1 ; 1 ] + K1\n (-q + q^-1)*[ K1 ; 1 ] + K1 |--> K1\n E[a1] |--> F[a1]\n sage: H(phi) == phi\n True\n sage: H2 = Hom(Q, Q, Modules(Fields()))\n sage: H == H2\n False\n sage: H2(phi)\n Quantum group homomorphism endomorphism of Quantum Group of type ['A', 1] with q=q\n Defn: F[a1] |--> E[a1]\n K1 |--> (-q + q^-1)*[ K1 ; 1 ] + K1\n (-q + q^-1)*[ K1 ; 1 ] + K1 |--> K1\n E[a1] |--> F[a1]\n "
if isinstance(im_gens, QuantumGroupMorphism):
if (im_gens.parent() is self):
return im_gens
if (im_gens.parent() != self):
return QuantumGroupMorphism(self, im_gens.im_gens())
raise TypeError('unable to coerce {}'.format(im_gens))
return QuantumGroupMorphism(self, im_gens)
|
def projection_lower_half(Q):
"\n Return the projection onto the lower half of the quantum group.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import projection_lower_half\n sage: Q = QuantumGroup(['G',2])\n sage: phi = projection_lower_half(Q); phi\n Quantum group homomorphism endomorphism of Quantum Group of type ['G', 2] with q=q\n Defn: F[a1] |--> F[a1]\n F[a2] |--> F[a2]\n K1 |--> 0\n K2 |--> 0\n (-q + q^-1)*[ K1 ; 1 ] + K1 |--> 0\n (-q^3 + q^-3)*[ K2 ; 1 ] + K2 |--> 0\n E[a1] |--> 0\n E[a2] |--> 0\n sage: all(phi(f) == f for f in Q.F())\n True\n sage: all(phi(e) == Q.zero() for e in Q.E())\n True\n sage: all(phi(K) == Q.zero() for K in Q.K())\n True\n "
I = Q._cartan_type.index_set()
return Hom(Q, Q)((list(Q.F_simple()) + ([Q.zero()] * (len(I) * 3))))
|
class QuaGroupRepresentationElement(QuaGroupModuleElement):
'\n Element of a quantum group representation.\n '
def __reduce__(self):
"\n Used in pickling.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: V = Q.highest_weight_module([2,1])\n sage: v = V.highest_weight_vector()\n sage: x = (2 - q) * v + F1*v + q*F2*F1*v\n sage: loads(dumps(x)) == x\n True\n "
return (self.parent(), (self.monomial_coefficients(),))
def _acted_upon_(self, scalar, self_on_left=False):
"\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['B',2])\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: V = Q.highest_weight_module([2,1])\n sage: v = V.highest_weight_vector()\n sage: F1 * v\n F[a1]*v0\n sage: F2 * v\n F[a2]*v0\n sage: F1^2 * v\n (q^2 + q^-2)*F[a1]^(2)*v0\n sage: F2^2 * v\n 0*v0\n sage: (F1 * F2) * v\n F[a1]*F[a2]*v0\n sage: F1 * (F2 * v)\n F[a1]*F[a2]*v0\n sage: (2 - q) * v + F1*v + q*F2*F1*v\n (-q + 2)*1*v0 + F[a1]*v0 + (q^3)*F[a1]*F[a2]*v0 + (q)*F[a1+a2]*v0\n "
try:
if (scalar.parent() is self.parent()._Q):
if self_on_left:
return None
return self.__class__(self.parent(), (scalar._libgap ** self._libgap))
except AttributeError:
pass
return QuaGroupModuleElement._acted_upon_(self, scalar, self_on_left)
_lmul_ = _acted_upon_
def _et(self, i):
"\n Return the action of `\\widetilde{e}_i` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: v = V.highest_weight_vector()\n sage: v._et(1)\n 0*v0\n sage: V.zero().e_tilde(1)\n 0*v0\n "
if (not self):
return self
V = self.parent()
ret = V._libgap.Ealpha(self._libgap, i)
return self.__class__(V, ret)
def _ft(self, i):
"\n Return the action of `\\widetilde{e}_i` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['C',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: v = V.highest_weight_vector()\n sage: v._ft(1)\n F[a1]*v0\n sage: v._ft(2)\n F[a2]*v0\n sage: v.f_tilde([1,1])\n 0*v0\n sage: v.f_tilde([2,2])\n 0*v0\n sage: v.f_tilde([2,1,1])\n (-q^-3)*F[a1]*F[a1+a2]*v0 + (-q^-4)*F[2*a1+a2]*v0\n sage: v.f_tilde([1,2,2])\n F[a1+a2]*F[a2]*v0\n sage: V.zero().f_tilde(1)\n 0*v0\n "
if (not self):
return self
V = self.parent()
ret = V._libgap.Falpha(self._libgap, i)
return self.__class__(V, ret)
def monomial_coefficients(self, copy=True):
"\n Return the dictionary of ``self`` whose keys are the basis indices\n and the values are coefficients.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: v = V.highest_weight_vector()\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: x = v + F1*v + q*F2*F1*v; x\n 1*v0 + F[a1]*v0 + (q^2)*F[a1]*F[a2]*v0 + (q)*F[a1+a2]*v0\n sage: sorted(x.monomial_coefficients().items(), key=str)\n [(0, 1), (1, 1), (3, q^2), (4, q)]\n "
R = self.parent()._Q.base_ring()
B = self.parent()._libgap.Basis()
data = [R(str(c)) for c in libgap.Coefficients(B, self._libgap)]
return {i: c for (i, c) in enumerate(data) if (c != 0)}
def _vector_(self, R=None, order=None, sparse=False):
"\n Return ``self`` as a vector.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: v = V.highest_weight_vector()\n sage: vector(v)\n (1, 0, 0, 0, 0, 0, 0, 0)\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: x = v + F1*v + q*F2*F1*v; x\n 1*v0 + F[a1]*v0 + (q^2)*F[a1]*F[a2]*v0 + (q)*F[a1+a2]*v0\n sage: vector(x)\n (1, 1, 0, q^2, q, 0, 0, 0)\n\n sage: v._vector_(sparse=True)\n (1, 0, 0, 0, 0, 0, 0, 0)\n sage: x._vector_(sparse=True)\n (1, 1, 0, q^2, q, 0, 0, 0)\n\n sage: M = V.submodule([V.an_element()])\n sage: M\n Free module generated by {0} over Fraction Field of Univariate Polynomial Ring in q over Rational Field\n "
V = self.parent()._dense_free_module(R)
if sparse:
V = V.sparse_module()
if (order is None):
return V(self.monomial_coefficients())
v = copy(V.zero())
if (order is None):
for (i, c) in self.monomial_coefficients().items():
v[i] = c
else:
for (i, c) in self.monomial_coefficients().items():
v[order[i]] = c
return v
|
class CrystalGraphVertex(SageObject):
'\n Helper class used as the vertices of a crystal graph.\n '
def __init__(self, V, s):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import CrystalGraphVertex\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: v = CrystalGraphVertex(V, '<F2*v0>')\n sage: TestSuite(v).run()\n "
self.V = V
self.s = s
def __hash__(self):
"\n Return the hash of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import CrystalGraphVertex\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: v = CrystalGraphVertex(V, '<F2*v0>')\n sage: hash(v) == hash('<F2*v0>')\n True\n "
return hash(self.s)
def __eq__(self, other):
"\n Check equality of ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import CrystalGraphVertex\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: v = CrystalGraphVertex(V, '<F2*v0>')\n sage: vp = CrystalGraphVertex(V, '<F2*v0>')\n sage: v == vp\n True\n sage: vpp = CrystalGraphVertex(V, '<1*v0>')\n sage: v == vpp\n False\n "
return (isinstance(other, CrystalGraphVertex) and (self.s == other.s))
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import CrystalGraphVertex\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: CrystalGraphVertex(V, '<F2*v0>')\n <F2*v0>\n "
return self.s
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import CrystalGraphVertex\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: v = CrystalGraphVertex(V, '<F2*v0>')\n sage: latex(v)\n \\langle F_{\\alpha_{1} + \\alpha_{2}} v_0 \\rangle\n "
from sage.misc.latex import latex
ret = self.s[1:(- 1)]
for (i, al) in enumerate(self.V._pos_roots):
ret = ret.replace(('F%s' % (i + 1)), ('F_{%s}' % latex(al)))
ret = ret.replace(('E%s' % (i + 1)), ('E_{%s}' % latex(al)))
for (i, ii) in enumerate(self.V._cartan_type.index_set()):
ret = ret.replace(('K%s' % (i + 1)), ('K_{%s}' % ii))
ret = ret.replace('(', '{(')
ret = ret.replace(')', ')}')
ret = ret.replace('v0', 'v_0')
ret = ret.replace('*', ' ')
ret = ret.replace('<x>', ' \\otimes ')
c = re.compile('q\\^-?[0-9]*')
for m in reversed(list(c.finditer(ret))):
ret = ((((ret[:(m.start() + 2)] + '{') + ret[(m.start() + 2):m.end()]) + '}') + ret[m.end():])
return '\\langle {} \\rangle'.format(ret)
|
class QuantumGroupModule(Parent, UniqueRepresentation):
'\n Abstract base class for quantum group representations.\n '
def __init__(self, Q, category):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['G',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: TestSuite(V).run()\n "
self._Q = Q
self._libgap_q = Q._libgap_q
self._libgap_base = Q._libgap_base
self._cartan_type = Q._cartan_type
self._pos_roots = Q._pos_roots
Parent.__init__(self, base=Q.base_ring(), category=category)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[0]\n sage: latex(S)\n \\begin{tikzpicture}...\n ...\n \\end{tikzpicture}\n "
from sage.misc.latex import latex
return latex(self.crystal_graph())
def gap(self):
"\n Return the gap representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: V.gap()\n <8-dimensional left-module over QuantumUEA( <root system of type A2>,\n Qpar = q )>\n "
return self._libgap
_libgap_ = _gap_ = gap
def _element_constructor_(self, elt):
"\n Construct an element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: q = Q.q()\n sage: V(0)\n 0*v0\n sage: V({1: q^2 - q^-2, 3: 2})\n (q^2-q^-2)*F[a1]*v0 + (2)*F[a1]*F[a2]*v0\n "
if (not elt):
return self.zero()
if isinstance(elt, dict):
return self._from_dict(elt)
return self.element_class(self, elt)
@cached_method
def basis(self):
"\n Return a basis of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: V.basis()\n Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0, F[a1+a2]*v0,\n F[a1]*F[a1+a2]*v0, F[a1+a2]*F[a2]*v0, F[a1+a2]^(2)*v0)\n "
return Family([self.element_class(self, b) for b in self._libgap.Basis()])
@cached_method
def crystal_basis(self):
"\n Return the crystal basis of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: V.crystal_basis()\n Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0,\n (q)*F[a1]*F[a2]*v0 + F[a1+a2]*v0, F[a1+a2]*F[a2]*v0,\n (-q^-2)*F[a1]*F[a1+a2]*v0, (-q^-1)*F[a1+a2]^(2)*v0)\n "
return Family([self.element_class(self, b) for b in self._libgap.CrystalBasis()])
@cached_method
def R_matrix(self):
"\n Return the `R`-matrix of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',1])\n sage: V = Q.highest_weight_module([1])\n sage: V.R_matrix()\n [ 1 0 0 0]\n [ 0 q -q^2 + 1 0]\n [ 0 0 q 0]\n [ 0 0 0 1]\n "
R = self._libgap.RMatrix()
F = self._Q.base_ring()
from sage.matrix.constructor import matrix
M = matrix(F, [[F(str(elt)) for elt in row] for row in R])
M.set_immutable()
return M
def crystal_graph(self):
"\n Return the crystal graph of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: G = V.crystal_graph(); G\n Digraph on 8 vertices\n\n sage: B = crystals.Tableaux(['A',2], shape=[2,1])\n sage: G.is_isomorphic(B.digraph(), edge_labels=True)\n True\n "
G = self._libgap.CrystalGraph()
vertices = [CrystalGraphVertex(self, repr(p)) for p in G['points']]
edges = [[vertices[(e[0][0] - 1)], vertices[(e[0][1] - 1)], e[1]] for e in G['edges'].sage()]
G = DiGraph([vertices, edges], format='vertices_and_edges')
from sage.graphs.dot2tex_utils import have_dot2tex
if have_dot2tex():
G.set_latex_options(format='dot2tex', edge_labels=True, color_by_label=self._cartan_type._index_set_coloring)
return G
@cached_method
def zero(self):
"\n Return the zero element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: V.zero()\n 0*v0\n "
return self.element_class(self, self._libgap.ZeroImmutable())
|
class HighestWeightModule(QuantumGroupModule):
'\n A highest weight module of a quantum group.\n '
@staticmethod
def __classcall_private__(cls, Q, weight):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: La = Q.cartan_type().root_system().weight_lattice().fundamental_weights()\n sage: V = Q.highest_weight_module([1,3])\n sage: V is Q.highest_weight_module(La[1]+3*La[2])\n True\n "
P = Q._cartan_type.root_system().weight_lattice()
if isinstance(weight, (list, tuple)):
La = P.fundamental_weights()
weight = P.sum(((la * weight[i]) for (i, la) in enumerate(La)))
else:
weight = P(weight)
return super().__classcall__(cls, Q, weight)
def __init__(self, Q, weight):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: TestSuite(V).run()\n "
self._libgap = Q._libgap.HighestWeightModule(list(weight.to_vector()))
self._weight = weight
cat = Modules(Q.base_ring()).FiniteDimensional().WithBasis()
QuantumGroupModule.__init__(self, Q, cat)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.highest_weight_module([1,1])\n Highest weight module of weight Lambda[1] + Lambda[2] of\n Quantum Group of type ['A', 2] with q=q\n "
return 'Highest weight module of weight {} of {}'.format(self._weight, self._Q)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,2])\n sage: latex(V)\n V(\\Lambda_{1} + 2 \\Lambda_{2})\n "
from sage.misc.latex import latex
return 'V({})'.format(latex(self._weight))
@cached_method
def highest_weight_vector(self):
"\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: V.highest_weight_vector()\n 1*v0\n "
return self.element_class(self, self._libgap.HighestWeightsAndVectors()[1][0][0])
an_element = highest_weight_vector
def tensor(self, *V, **options):
"\n Return the tensor product of ``self`` with ``V``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: Vp = Q.highest_weight_module([1,0])\n sage: Vp.tensor(V)\n Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q\n # Highest weight module of weight Lambda[1] + Lambda[2] of Quantum Group of type ['A', 2] with q=q\n "
return TensorProductOfHighestWeightModules(self, *V, **options)
Element = QuaGroupRepresentationElement
|
class TensorProductOfHighestWeightModules(QuantumGroupModule):
def __init__(self, *modules, **options):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,1])\n sage: T = tensor([V,V])\n sage: TestSuite(T).run()\n "
Q = modules[0]._Q
self._modules = tuple(modules)
self._libgap = libgap.TensorProductOfAlgebraModules([m._libgap for m in modules])
cat = Modules(Q.base_ring()).TensorProducts().FiniteDimensional().WithBasis()
QuantumGroupModule.__init__(self, Q, category=cat)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T\n Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q\n # Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q\n "
return ' # '.join((repr(M) for M in self._modules))
def _latex_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: latex(T)\n V(\\Lambda_{1}) \\otimes V(\\Lambda_{1})\n "
from sage.misc.latex import latex
return ' \\otimes '.join((latex(M) for M in self._modules))
@lazy_attribute
def _highest_weights_and_vectors(self):
"\n Return the highest weights and the corresponding vectors.\n\n .. NOTE::\n\n The resulting objects are GAP objects.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([0,1])\n sage: T = tensor([V,V])\n sage: T._highest_weights_and_vectors\n [ [ [ 0, 2 ], [ 1, 0 ] ],\n [ [ 1*(1*v0<x>1*v0) ], [ -q^-1*(1*v0<x>F3*v0)+1*(F3*v0<x>1*v0) ] ] ]\n "
return self._libgap.HighestWeightsAndVectors()
def highest_weight_vectors(self):
"\n Return the highest weight vectors of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T.highest_weight_vectors()\n [1*(1*v0<x>1*v0), -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]\n "
return [self.element_class(self, v) for vecs in self._highest_weights_and_vectors[1] for v in vecs]
some_elements = highest_weight_vectors
def _an_element_(self):
"\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T.an_element()\n 1*(1*v0<x>1*v0)\n "
return self.highest_weight_vectors()[0]
@cached_method
def highest_weight_decomposition(self):
"\n Return the highest weight decomposition of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T.highest_weight_decomposition()\n [Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0),\n Highest weight submodule with weight Lambda[2] generated by -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]\n "
return [HighestWeightSubmodule(self, self.element_class(self, v), tuple(wt.sage())) for (wt, vecs) in zip(*self._highest_weights_and_vectors) for v in vecs]
def tensor_factors(self):
"\n Return the factors of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T.tensor_factors()\n (Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q,\n Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q)\n "
return self._modules
Element = QuaGroupRepresentationElement
|
class HighestWeightSubmodule(QuantumGroupModule):
def __init__(self, ambient, gen, weight):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[0]\n sage: TestSuite(S).run()\n "
self._ambient = ambient
cat = Modules(ambient.base_ring()).FiniteDimensional().WithBasis()
QuantumGroupModule.__init__(self, ambient._Q, cat.Subobjects())
self._gen = gen
self._libgap = self._ambient._libgap.HWModuleByGenerator(gen, weight)
P = self._Q._cartan_type.root_system().weight_lattice()
La = P.fundamental_weights()
self._weight = P.sum(((la * weight[i]) for (i, la) in enumerate(La)))
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: T.highest_weight_decomposition()\n [Highest weight submodule with weight 2*Lambda[1]\n generated by 1*(1*v0<x>1*v0),\n Highest weight submodule with weight Lambda[2]\n generated by -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]\n "
return 'Highest weight submodule with weight {} generated by {}'.format(self._weight, self._gen)
@lazy_attribute
def _ambient_basis_map(self):
"\n A dict that maps the basis of ``self`` to the ambient module.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[0]\n sage: S._ambient_basis_map\n {0: 1*(1*v0<x>1*v0),\n 1: 1*(1*v0<x>F[a1]*v0) + q^-1*(F[a1]*v0<x>1*v0),\n 2: 1*(F[a1]*v0<x>F[a1]*v0),\n 3: 1*(1*v0<x>F[a1+a2]*v0) + q^-1*(F[a1+a2]*v0<x>1*v0),\n 4: 1*(F[a1]*v0<x>F[a1+a2]*v0) + q^-1*(F[a1+a2]*v0<x>F[a1]*v0),\n 5: 1*(F[a1+a2]*v0<x>F[a1+a2]*v0)}\n "
B = list(self.basis())
d = {self.highest_weight_vector(): self._gen}
todo = {self.highest_weight_vector()}
I = self._cartan_type.index_set()
while todo:
x = todo.pop()
for i in I:
y = x.f_tilde(i)
if (y and (y not in d)):
d[y] = d[x].f_tilde(i)
todo.add(y)
return {B.index(k): d[k] for k in d}
def ambient(self):
"\n Return the ambient module of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[0]\n sage: S.ambient() is T\n True\n "
return self._ambient
@lazy_attribute
def lift(self):
"\n The lift morphism from ``self`` to the ambient space.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[0]\n sage: S.lift\n Generic morphism:\n From: Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0)\n To: Highest weight module ... # Highest weight module ...\n sage: x = sum(S.basis())\n sage: x.lift()\n 1*(1*v0<x>1*v0) + 1*(1*v0<x>F[a1]*v0) + 1*(1*v0<x>F[a1+a2]*v0)\n + q^-1*(F[a1]*v0<x>1*v0) + 1*(F[a1]*v0<x>F[a1]*v0)\n + 1*(F[a1]*v0<x>F[a1+a2]*v0) + q^-1*(F[a1+a2]*v0<x>1*v0)\n + q^-1*(F[a1+a2]*v0<x>F[a1]*v0) + 1*(F[a1+a2]*v0<x>F[a1+a2]*v0)\n "
return self.module_morphism(self._ambient_basis_map.__getitem__, codomain=self._ambient, unitriangular='lower')
def retract(self, elt):
"\n The retract map from the ambient space to ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: all(S.retract(S.lift(x)) == x\n ....: for S in T.highest_weight_decomposition()\n ....: for x in S.basis())\n True\n "
c = self.lift.matrix().solve_right(elt._vector_())
return self._from_dict(c.dict(), coerce=False, remove_zeros=False)
def highest_weight_vector(self):
"\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[1]\n sage: u = S.highest_weight_vector(); u\n (1)*e.1\n sage: u.lift()\n -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)\n "
I = self._cartan_type.index_set()
zero = self._libgap.ZeroImmutable()
for v in self.basis():
if all(((self._libgap.Ealpha(v._libgap, i) == zero) for i in I)):
return v
return self.zero()
an_element = highest_weight_vector
def crystal_graph(self, use_ambient=True):
"\n Return the crystal graph of ``self``.\n\n INPUT:\n\n - ``use_ambient`` -- boolean (default: ``True``); if ``True``,\n the vertices are given in terms of the ambient module\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: V = Q.highest_weight_module([1,0])\n sage: T = tensor([V,V])\n sage: S = T.highest_weight_decomposition()[1]\n sage: G = S.crystal_graph()\n sage: sorted(G.vertices(sort=False), key=str)\n [<-q^-1*(1*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>1*v0)>,\n <-q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)>,\n <-q^-1*(F[a1]*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>F[a1]*v0)>]\n sage: sorted(S.crystal_graph(False).vertices(sort=False), key=str)\n [<(1)*e.1>, <(1)*e.2>, <(1)*e.3>]\n "
G = self._libgap.CrystalGraph()
if (not use_ambient):
return QuantumGroupModule.crystal_graph(self)
B = self.basis()
d = {repr(B[k]._libgap): '<{!r}>'.format(self._ambient_basis_map[k]) for k in self._ambient_basis_map}
vertices = [CrystalGraphVertex(self, d[repr(p)[1:(- 1)]]) for p in G['points']]
edges = [[vertices[(e[0][0] - 1)], vertices[(e[0][1] - 1)], e[1]] for e in G['edges'].sage()]
G = DiGraph([vertices, edges], format='vertices_and_edges')
from sage.graphs.dot2tex_utils import have_dot2tex
if have_dot2tex():
G.set_latex_options(format='dot2tex', edge_labels=True, color_by_label=self._cartan_type._index_set_coloring)
return G
Element = QuaGroupRepresentationElement
|
class LowerHalfQuantumGroup(Parent, UniqueRepresentation):
'\n The lower half of the quantum group.\n '
@staticmethod
def __classcall_private__(cls, Q):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: from sage.algebras.quantum_groups.quantum_group_gap import LowerHalfQuantumGroup\n sage: Q = QuantumGroup(['A',2])\n sage: Q.lower_half() is LowerHalfQuantumGroup(Q)\n True\n "
from sage.combinat.root_system.cartan_type import CartanType_abstract
if isinstance(Q, CartanType_abstract):
Q = QuantumGroup(Q)
return super().__classcall__(cls, Q)
def __init__(self, Q):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: TestSuite(B).run()\n "
self._Q = Q
self._libgap = Q._libgap
self._libgap_q = Q._libgap_q
self._libgap_base = Q._libgap_base
self._cartan_type = Q._cartan_type
self._pos_roots = Q._pos_roots
self._proj = projection_lower_half(Q)
B = Q.base_ring()
Parent.__init__(self, base=B, category=Algebras(B).WithBasis().Subobjects())
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: Q.lower_half()\n Lower Half of Quantum Group of type ['A', 2] with q=q\n "
return 'Lower Half of {}'.format(self._Q)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: latex(Q.lower_half())\n U^-_{q}(A_{2})\n "
from sage.misc.latex import latex
return ('U^-_{%s}(%s)' % (latex(self._Q._q), latex(self._cartan_type)))
def _element_constructor_(self, elt):
"\n Construct an element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: q = Q.q()\n sage: B(0)\n 0\n sage: B(1 + q^2)\n (q^2 + 1)*1\n sage: B({(1,2,0): q, (0,0,2): q^2 - 2})\n (q)*F[a1]*F[a1+a2]^(2) + (q^2-2)*F[a2]^(2)\n "
if (not elt):
return self.zero()
if isinstance(elt, dict):
return self._from_dict(elt)
if (elt in self.base_ring()):
return (elt * self.one())
if (elt.parent() is self._Q):
return self.element_class(self, self._proj(elt)._libgap)
return self.element_class(self, elt)
def ambient(self):
"\n Return the ambient quantum group of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B.ambient() is Q\n True\n "
return self._Q
@cached_method
def highest_weight_vector(self):
"\n Return the highest weight vector of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B.highest_weight_vector()\n 1\n "
return self.element_class(self, self._Q.one()._libgap)
one = highest_weight_vector
an_element = highest_weight_vector
@cached_method
def zero(self):
"\n Return the zero element of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B.zero()\n 0\n "
return self.element_class(self, self._Q._libgap.ZeroImmutable())
@cached_method
def algebra_generators(self):
"\n Return the algebra generators of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B.algebra_generators()\n Finite family {1: F[a1], 2: F[a2]}\n "
F = self._Q.F_simple()
keys = F.keys()
d = {i: self.element_class(self, F[i]._libgap) for i in keys}
return Family(keys, d.__getitem__)
gens = algebra_generators
def _construct_monomial(self, k):
"\n Construct a monomial of ``self`` indexed by ``k``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B._construct_monomial((1,2,1))\n F[a1]*F[a1+a2]^(2)*F[a2]\n sage: B._construct_monomial((3,0,1))\n F[a1]^(3)*F[a2]\n "
F = libgap.eval('ElementsFamily')(libgap.eval('FamilyObj')(self._libgap))
one = self._libgap_base.One()
data = []
for (i, val) in enumerate(k):
if (val == 0):
continue
data.append((i + 1))
data.append(val)
return self.element_class(self, F.ObjByExtRep([data, one]))
@cached_method
def basis(self):
"\n Return the basis of ``self``.\n\n This returns the PBW basis of ``self``, which is given by\n monomials in `\\{F_{\\alpha}\\}`, where `\\alpha` runs over all\n positive roots.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: basis = B.basis(); basis\n Lazy family (monomial(i))_{i in The Cartesian product of\n (Non negative integers, Non negative integers, Non negative integers)}\n sage: basis[1,2,1]\n F[a1]*F[a1+a2]^(2)*F[a2]\n sage: basis[1,2,4]\n F[a1]*F[a1+a2]^(2)*F[a2]^(4)\n sage: basis[1,0,4]\n F[a1]*F[a2]^(4)\n "
I = cartesian_product(([NonNegativeIntegers()] * len(self._pos_roots)))
return Family(I, self._construct_monomial, name='monomial')
def _construct_canonical_basis_elts(self, k):
"\n Construct the monomial elements of ``self`` indexed by ``k``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: B._construct_canonical_basis_elts((1,2))\n [F[a1]*F[a2]^(2), (q^2)*F[a1]*F[a2]^(2) + F[a1+a2]*F[a2]]\n "
B = self._libgap.CanonicalBasis()
return [self.element_class(self, v) for v in B.PBWElements(k)]
@cached_method
def canonical_basis_elements(self):
"\n Construct the monomial elements of ``self`` indexed by ``k``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: C = B.canonical_basis_elements(); C\n Lazy family (Canonical basis(i))_{i in The Cartesian product of\n (Non negative integers, Non negative integers)}\n sage: C[2,1]\n [F[a1]^(2)*F[a2], F[a1]*F[a1+a2] + (q^2)*F[a1]^(2)*F[a2]]\n sage: C[1,2]\n [F[a1]*F[a2]^(2), (q^2)*F[a1]*F[a2]^(2) + F[a1+a2]*F[a2]]\n "
I = cartesian_product(([NonNegativeIntegers()] * len(self._cartan_type.index_set())))
return Family(I, self._construct_canonical_basis_elts, name='Canonical basis')
def lift(self, elt):
"\n Lift ``elt`` to the ambient quantum group of ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: x = B.lift(B.an_element()); x\n 1\n sage: x.parent() is Q\n True\n "
return self._Q.element_class(self._Q, elt._libgap)
def retract(self, elt):
"\n Retract ``elt`` from the ambient quantum group to ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: x = Q.an_element(); x\n 1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]\n + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ]\n sage: B.retract(x)\n 1 + (q)*F[a1]\n "
return self.element_class(self, self._proj(elt)._libgap)
class Element(QuaGroupModuleElement):
'\n An element of the lower half of the quantum group.\n '
def _acted_upon_(self, scalar, self_on_left=False):
"\n Return the action of ``scalar`` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: F1, F2 = Q.F_simple()\n sage: v = B.highest_weight_vector(); v\n 1\n sage: 2 * v\n (2)*1\n sage: v * (3/2)\n (3/2)*1\n sage: F1 * v\n F[a1]\n sage: F2 * (F1 * v)\n (q)*F[a1]*F[a2] + F[a1+a2]\n sage: (F1 * v) * F2\n F[a1]*F[a2]\n "
try:
if (scalar.parent() is self.parent()._Q):
if self_on_left:
ret = (self._libgap * scalar._libgap)
else:
ret = (scalar._libgap * self._libgap)
return self.__class__(self.parent(), self.parent()._proj(ret)._libgap)
except AttributeError:
pass
return QuaGroupModuleElement._acted_upon_(self, scalar, self_on_left)
_lmul_ = _acted_upon_
def _mul_(self, other):
"\n Multiply ``self`` and ``other``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: F1, F2 = Q.F_simple()\n sage: v = B.highest_weight_vector()\n sage: f1, f2 = F1 * v, F2 * v\n sage: f1 * f2\n F[a1]*F[a2]\n sage: f1^2 * f2\n (q + q^-1)*F[a1]^(2)*F[a2]\n sage: f2 * f1^2 * f2\n (q + q^-1)*F[a1]*F[a1+a2]*F[a2]\n + (q^4 + 2*q^2 + 1)*F[a1]^(2)*F[a2]^(2)\n "
ret = self.parent()._proj((self._libgap * other._libgap))
return self.__class__(self.parent(), ret._libgap)
def monomial_coefficients(self, copy=True):
"\n Return the dictionary of ``self`` whose keys are the basis\n indices and the values are coefficients.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: B = Q.lower_half()\n sage: x = B.retract(Q.an_element()); x\n 1 + (q)*F[a1]\n sage: sorted(x.monomial_coefficients().items(), key=str)\n [((0, 0, 0), 1), ((1, 0, 0), q)]\n "
ext_rep = self._libgap.ExtRepOfObj()
num_pos_roots = len(self.parent()._pos_roots)
R = self.parent().base_ring()
d = {}
for i in range((len(ext_rep) // 2)):
exp = ([0] * num_pos_roots)
mon = ext_rep[(2 * i)].sage()
for j in range((len(mon) // 2)):
exp[(mon[(2 * j)] - 1)] = mon[((2 * j) + 1)]
d[tuple(exp)] = R(str(ext_rep[((2 * i) + 1)]))
return d
def bar(self):
"\n Return the bar involution on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: F1, F2 = Q.F_simple()\n sage: B = Q.lower_half()\n sage: x = B(Q.an_element()); x\n 1 + (q)*F[a1]\n sage: x.bar()\n 1 + (q^-1)*F[a1]\n sage: (F1*x).bar() == F1 * x.bar()\n True\n sage: (F2*x).bar() == F2 * x.bar()\n True\n\n sage: Q = QuantumGroup(['G',2])\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: B = Q.lower_half()\n sage: x = B(q^-2*F1*F2^2*F1)\n sage: x\n (q + q^-5)*F[a1]*F[a1+a2]*F[a2]\n + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)\n sage: x.bar()\n (q^5 + q^-1)*F[a1]*F[a1+a2]*F[a2]\n + (q^12 + q^10 + q^6 + q^4)*F[a1]^(2)*F[a2]^(2)\n "
bar = self.parent()._libgap.BarAutomorphism()
return self.__class__(self.parent(), libgap.Image(bar, self._libgap))
def tau(self):
"\n Return the action of the `\\tau` anti-automorphism on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: F1, F2 = Q.F_simple()\n sage: B = Q.lower_half()\n sage: x = B(Q.an_element()); x\n 1 + (q)*F[a1]\n sage: x.tau()\n 1 + (q)*F[a1]\n sage: (F1*x).tau() == x.tau() * F1.tau()\n True\n sage: (F2*x).tau() == x.tau() * F2.tau()\n True\n\n sage: Q = QuantumGroup(['G',2])\n sage: F1, F2 = Q.F_simple()\n sage: q = Q.q()\n sage: B = Q.lower_half()\n sage: x = B(q^-2*F1*F2^2*F1)\n sage: x\n (q + q^-5)*F[a1]*F[a1+a2]*F[a2]\n + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)\n sage: x.tau()\n (q + q^-5)*F[a1]*F[a1+a2]*F[a2]\n + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)\n "
tau = self.parent()._libgap.AntiAutomorphismTau()
return self.__class__(self.parent(), libgap.Image(tau, self._libgap))
def braid_group_action(self, braid):
"\n Return the action of the braid group element ``braid``\n projected into ``self``.\n\n INPUT:\n\n - ``braid`` -- a reduced word of a braid group element\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: L = Q.lower_half()\n sage: v = L.highest_weight_vector().f_tilde([1,2,2,1]); v\n F[a1]*F[a1+a2]*F[a2]\n sage: v.braid_group_action([1])\n (-q^3-q)*F[a2]^(2)\n sage: v.braid_group_action([]) == v\n True\n "
if (not braid):
return self
Q = self.parent()
QU = Q._libgap
tau = QU.AntiAutomorphismTau()
f = QU.IdentityMapping()
for i in braid:
if (i < 0):
i = (- i)
T = QU.AutomorphismTalpha(i)
f *= ((tau * T) * tau)
else:
f *= QU.AutomorphismTalpha(i)
ret = libgap.Image(f, self._libgap)
return self.__class__(Q, Q._proj(ret)._libgap)
def _et(self, i):
"\n Return the action of `\\widetilde{e}_i` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: L = Q.lower_half()\n sage: v = L.highest_weight_vector()\n sage: v._et(1)\n 0\n sage: w = v.f_tilde([1,2,1]); w\n F[a1]*F[a1+a2]\n sage: w._et(1)\n F[a1+a2]\n sage: w._et(2)\n F[a1]^(2)\n sage: L.zero().e_tilde(1)\n 0\n "
if (not self):
return self
Q = self.parent()
ret = self._libgap.Ealpha(i)
if (not ret):
return self.parent().zero()
return self.__class__(Q, Q._proj(ret)._libgap)
def _ft(self, i):
"\n Return the action of `\\widetilde{e}_i` on ``self``.\n\n EXAMPLES::\n\n sage: Q = QuantumGroup(['A',2])\n sage: L = Q.lower_half()\n sage: v = L.highest_weight_vector()\n sage: v._ft(1)\n F[a1]\n sage: L.zero().f_tilde(1)\n 0\n "
if (not self):
return self
Q = self.parent()
ret = self._libgap.Falpha(i)
if (not ret):
return self.parent().zero()
return self.__class__(Q, Q._proj(ret)._libgap)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.