# Creating PBW-Algebras

## Types

PBW-algebras are modelled by objects of type PBWAlgRing{T, S} <: NCRing, their elements are objects of type PBWAlgElem{T, S} <: NCRingElem. Here, T is the element type of the field over which the PBW-algebra is defined (the type S is added for internal use).

## Constructors

The basic constructor below allows one to build PBW-algebras:

pbw_algebraMethod
pbw_algebra(R::MPolyRing{T}, rel, ord::MonomialOrdering; check = true) where T

Given a multivariate polynomial ring R over a field, say $R=K[x_1, \dots, x_n]$, given a strictly upper triangular matrix rel with entries in R of type $c_{ij} \cdot x_ix_j+d_{ij}$, where the $c_{ij}$ are nonzero scalars and where we think of the $x_jx_i = c_{ij} \cdot x_ix_j+d_{ij}$ as setting up relations in the free associative algebra $K\langle x_1, \dots , x_n\rangle$, and given an ordering ord on $\text{Mon}(x_1, \dots, x_n)$, return the PBW-algebra

$$$A = K\langle x_1, \dots , x_n \mid x_jx_i = c_{ij} \cdot x_ix_j+d_{ij}, \ 1\leq i Note The input data gives indeed rise to a PBW-algebra if: • The ordering ord is admissible for A. • The standard monomials in K\langle x_1, \dots , x_n\rangle represent a K-basis for A. See the definition of PBW-algebras in the OSCAR documentation for details. Note The K-basis condition above is checked by default. This check may be skipped by passing check = false. Examples julia> R, (x, y, z) = QQ["x", "y", "z"]; julia> L = [x*y, x*z, y*z + 1]; julia> REL = strictly_upper_triangular_matrix(L); julia> A, (x, y, z) = pbw_algebra(R, REL, deglex(gens(R))) (PBW-algebra over Rational Field in x, y, z with relations y*x = x*y, z*x = x*z, z*y = y*z + 1, PBWAlgElem{fmpq, Singular.n_Q}[x, y, z]) source Some PBW-algebras are predefined in OSCAR. ### Weyl Algebras The n-th Weyl algebra over a field K is the PBW-algebra $$\[D_n(K)=K \langle x_1,\ldots, x_n, \partial _1,\dots \partial _n \mid \partial_i x_i=x_i\partial _i +1, \partial _i x_j=x_j \partial _i \ \text { for }\ i\neq j\rangle.$$$

Here, we tacitly assume that

$$$x_j x_i=x_i x _j \; \text{ and } \; \partial _j \partial_i=\partial_i \partial _j \; \text{ for all } \; i,j.$$$

Note that any global monomial ordering on $\text{Mon}_{2n}(x, \partial)$ is admissible for $D_n(K)$.

The constructor below returns the algebras equipped with degrevlex.

weyl_algebraMethod
weyl_algebra(K::Ring, xs::Union{AbstractVector{<:AbstractString},
AbstractVector{Symbol}, AbstractVector{Char}})

Given a field K and a vector xs of, say, $n$ Strings, Symbols, or Characters, return the $n$-th Weyl algebra over K.

The generators of the returned algebra print according to the entries of xs. See the example below.

Examples

julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"])
(PBW-algebra over Rational Field in x, y, dx, dy with relations y*x = x*y, dx*x = x*dx + 1, dy*x = x*dy, dx*y = y*dx, dy*y = y*dy + 1, dy*dx = dx*dy, PBWAlgElem{fmpq, Singular.n_Q}[x, y, dx, dy])

julia> dx*x
x*dx + 1
source

### Universal Enveloping Algebras of Finite Dimensional Lie Algebras

Let $\mathfrak g$ be an $n$-dimensional Lie algebra over a field $K$, and let $x_1, \dots, x_n$ be a $K$-basis of $\mathfrak g$. Consider $n$ indeterminates which are also denoted by $x_1, \dots, x_n$. The universal enveloping algebra of $\mathfrak g$ is the PBW-algebra

$$\[U(\mathfrak g)=K \langle x_1,\ldots, x_n \mid x_jx_i = x_ix_j+[x_j, x_i], \ 1\leq i

where $[x_j, x_i]$ corresponds to evaluating the Lie bracket $[x_j, x_i]_\mathfrak g$. That the standard monomials in $U(\mathfrak g)$ indeed form a $K$-basis for $U(\mathfrak g)$ is the content of the Poincar$\'{\text{e}}$-Birkhoff-Witt theorem (the names PBW-basis and PBW-algebra are derived from this fact).

Note that any degree compatible global monomial ordering on $\N^n$ is admissible for $U(\mathfrak g)$.

The constructors below return the algebras equipped with degrevlex.

## Data Associated to PBW-Algebras

Given a PBW-algebra A over a field K,

• coefficient_ring(A) refers to K,
• gens(A) to the generators of A,
• ngens(A) to the number of these generators, and
• gen(A, i) as well as A[i] to the i-th such generator.
###### Examples
julia> R, (x,y,z) = QQ["x", "y", "z"];

julia> L = [x*y, x*z, y*z + 1];

julia> REL = strictly_upper_triangular_matrix(L);

julia> A, (x,y,z) = pbw_algebra(R, REL, deglex(gens(R)));

julia> coefficient_ring(A)
Rational Field

julia> gens(A)
3-element Vector{PBWAlgElem{fmpq, Singular.n_Q}}:
x
y
z

julia> gen(A, 2)
y

julia> A[3]
z

julia> ngens(A)
3


## Elements of PBW-Algebras

Elements of PBW-algebras are stored and printed in their standard representation.

### Constructors

One way to create elements of a PBW-algebra A over a field K is to build them up from the generators of A using basic arithmetic as shown below:

###### Examples
julia> R, (x,y,z) = QQ["x", "y", "z"];

julia> L = [x*y, x*z, y*z + 1];

julia> REL = strictly_upper_triangular_matrix(L);

julia> A, (x,y,z) = pbw_algebra(R, REL, deglex(gens(R)));

julia> f = 3*x^2+z*y
3*x^2 + y*z + 1


Alternatively, there is the following constructor:

(A::PBWAlgRing)(cs::AbstractVector, es::AbstractVector{Vector{Int}})

Its return value is the element of A whose standard representation is built from the elements of cs as coefficients, and the elements of es as exponents.

###### Examples
julia> R, (x,y,z) = QQ["x", "y", "z"];

julia> L = [x*y, x*z, y*z + 1];

julia> REL = strictly_upper_triangular_matrix(L);

julia> A, (x,y,z) = pbw_algebra(R, REL, deglex(gens(R)));

julia> f = 3*x^2+z*y
3*x^2 + y*z + 1

julia> g = A(QQ.([3, 1, 1]), [[2, 0, 0], [0, 1, 1], [0, 0, 0]])
3*x^2 + y*z + 1

julia> f == g
true


An often more effective way to create elements is to use the corresponding build context as indicated below:

julia> R, (x,y,z) = QQ["x", "y", "z"];

julia> L = [x*y, x*z, y*z + 1];

julia> REL = strictly_upper_triangular_matrix(L);

julia> A, (x,y,z) = pbw_algebra(R, REL, deglex(gens(R)));

julia> B =  build_ctx(A);

julia> for i = 1:5 push_term!(B, QQ(i), [i+1, i, i-1]) end

julia> finish(B)
5*x^6*y^5*z^4 + 4*x^5*y^4*z^3 + 3*x^4*y^3*z^2 + 2*x^3*y^2*z + x^2*y


### Special Elements

Given a PBW-algebra A, zero(A) and one(A) refer to the additive and multiplicative identity of A, respectively. Relevant test calls on an element f of A are iszero(f) and isone(f).

### Data Associated to Elements of PBW-algebras

Given an element f of a PBW-algebra A,

• parent(f) refers to A,

## Opposite Algebras

opposite_algebraMethod
opposite_algebra(A::PBWAlgRing)

Return the opposite algebra of A.

Examples

julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"])
(PBW-algebra over Rational Field in x, y, dx, dy with relations y*x = x*y, dx*x = x*dx + 1, dy*x = x*dy, dx*y = y*dx, dy*y = y*dy + 1, dy*dx = dx*dy, PBWAlgElem{fmpq, Singular.n_Q}[x, y, dx, dy])

julia> Dop, opp = opposite_algebra(D);

julia> Dop
PBW-algebra over Rational Field in dy, dx, y, x with relations dx*dy = dy*dx, y*dy = dy*y + 1, x*dy = dy*x, y*dx = dx*y, x*dx = dx*x + 1, x*y = y*x

julia> opp
Map to opposite of PBW-algebra over Rational Field in x, y, dx, dy with relations y*x = x*y, dx*x = x*dx + 1, dy*x = x*dy, dx*y = y*dx, dy*y = y*dy + 1, dy*dx = dx*dy

julia> opp(dx*x)
dx*x + 1
source

If a map opp from a PBW-algebra to its opposite algebra is given, then inv(opp) refers to the inverse of opp.