Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LieAlgebras: further improvements and new features #2528

Merged
merged 28 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e0c07a6
LieAlgebras: Some type stability related changes
lgoettgens Jun 13, 2023
af97bb6
Remove dependency on `AbstractAlgebra._matrix`
lgoettgens Jul 5, 2023
b268851
Remove unneeded type parameters
lgoettgens Jul 5, 2023
2aed8ee
Add struct_consts parent check
lgoettgens Jul 5, 2023
37b1c83
Add `check` kwarg for `LinearLieAlgebra`
lgoettgens Jul 5, 2023
5e4686d
Replace `base_ring` by `coefficient_ring`
lgoettgens Jul 5, 2023
1d1e2ab
Add `universal_enveloping_algebra`
lgoettgens Jul 5, 2023
43eb175
First steps for LieAlgebraIdeal
lgoettgens Jul 6, 2023
4624b2a
More functionality for and with Lie algebra ideals
lgoettgens Jul 7, 2023
f084a36
Add nice dual constructor
lgoettgens Jul 11, 2023
b0df5a3
Implement pretty printing
lgoettgens Jul 11, 2023
80e2a38
Fix zero dimensional ideals
lgoettgens Jul 11, 2023
4531abf
Make LieAlgebraIdeal basis no longer lazy
lgoettgens Jul 12, 2023
7faef23
Fix LieAlgebraIdeal basis
lgoettgens Jul 12, 2023
48b82e5
Fix some printing
lgoettgens Jul 12, 2023
c5e6e2b
Add Lie subalgebras
lgoettgens Jul 12, 2023
5d00e39
Small doc fix
lgoettgens Jul 12, 2023
880696c
Add reference
lgoettgens Jul 13, 2023
9a3d40c
Make bibtool happy
lgoettgens Jul 13, 2023
b3efc7c
Add `centralizer` and `normalizer`
lgoettgens Jul 13, 2023
6758bdb
Add documentation
lgoettgens Jul 13, 2023
9473995
Add ideal and subalgebra tests
lgoettgens Jul 14, 2023
eaec892
Address some comments
lgoettgens Jul 21, 2023
2843a5b
Update == and hash
lgoettgens Jul 21, 2023
1e40cb8
Update docstrings
lgoettgens Jul 21, 2023
b031420
Add test for ==
lgoettgens Jul 21, 2023
e7f6534
Add parent check for `normalizer(::LieAlgebra,::LieAlgebraIdeal)`
lgoettgens Jul 21, 2023
479ff29
Use `===` for parent checks
lgoettgens Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/oscar_references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ @InProceedings{BES-E-D21
series = {ISSAC '21},
address = {New York, NY, USA},
publisher = {Association for Computing Machinery},
pages = {51-58},
pages = {51--58},
year = {2021},
doi = {10.1145/3452143.3465545},
url = {https://doi.org/10.1145/3452143.3465545},
Expand Down Expand Up @@ -654,7 +654,7 @@ @Article{FJR17
volume = {22},
number = {1},
publisher = {Mathematical Sciences Publishers},
pages = {235303},
pages = {235-303},
year = {2017},
month = {Oct},
doi = {10.2140/gt.2018.22.235},
Expand Down Expand Up @@ -894,6 +894,18 @@ @Book{Har77
url = {https://doi.org/10.1007/978-1-4757-3849-0}
}

@Book{Hum72,
author = {Humphreys, James E.},
title = {Introduction to Lie Algebras and Representation Theory},
series = {Graduate Texts in Mathematics},
volume = {9},
publisher = {Springer-Verlag, New York},
pages = {xii+169},
year = {1972},
doi = {10.1007/978-1-4612-6398-2},
url = {https://doi.org/10.1007/978-1-4612-6398-2}
}

@Book{Hup67,
author = {Huppert, B.},
title = {Endliche Gruppen. I},
Expand Down
1 change: 1 addition & 0 deletions experimental/LieAlgebras/docs/doc.main
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Lie Algebras" => [
"introduction.md",
"lie_algebras.md",
"ideals_and_subalgebras.md",
"modules.md",
],
]
65 changes: 65 additions & 0 deletions experimental/LieAlgebras/docs/src/ideals_and_subalgebras.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
```@meta
CurrentModule = Oscar
DocTestSetup = quote
using Oscar
end
```

# Ideals and Lie subalgebras

Ideals and Lie subalgebras are represented by the types `LieAlgebraIdeal` and
`LieSubalgebra` respectively.
They are used similarly in most cases.

## Functions

### Ideals

```@docs
dim(::LieAlgebraIdeal)
basis(::LieAlgebraIdeal)
basis(::LieAlgebraIdeal, ::Int)
Base.in(::LieAlgebraElem, ::LieAlgebraIdeal)
bracket(::LieAlgebraIdeal{C,LieT}, ::LieAlgebraIdeal{C,LieT}) where {C<:RingElement,LieT<:LieAlgebraElem{C}}
normalizer(::LieAlgebra, ::LieAlgebraIdeal)
centralizer(::LieAlgebra, ::LieAlgebraIdeal)
```

### Lie subalgebras

```@docs
dim(::LieSubalgebra)
basis(::LieSubalgebra)
basis(::LieSubalgebra, ::Int)
Base.in(::LieAlgebraElem, ::LieSubalgebra)
bracket(::LieSubalgebra{C,LieT}, ::LieSubalgebra{C,LieT}) where {C<:RingElement,LieT<:LieAlgebraElem{C}}
normalizer(::LieAlgebra, ::LieSubalgebra)
centralizer(::LieAlgebra, ::LieSubalgebra)
is_self_normalizing(S::LieSubalgebra)
```

## Constructors

### Ideals

```@docs
ideal(::LieAlgebra, ::Vector; is_basis::Bool=false)
ideal(::LieAlgebra{C}, ::LieAlgebraElem{C}) where {C<:RingElement}
ideal(::LieAlgebra)
```

### Lie subalgebras

```@docs
sub(::LieAlgebra, ::Vector; is_basis::Bool=false)
sub(::LieAlgebra{C}, ::LieAlgebraElem{C}) where {C<:RingElement}
sub(::LieAlgebra)
```

## Conversions

```@docs
lie_algebra(::LieSubalgebra)
lie_algebra(::LieAlgebraIdeal)
sub(::LieAlgebra{C}, ::LieAlgebraIdeal{C}) where {C<:RingElement}
```
1 change: 1 addition & 0 deletions experimental/LieAlgebras/docs/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ end
# Introduction

This project aims to provide functionality for Lie algebras and their representations.
It aims to provide the computational tools to work with the concepts defined in [Hum72](@cite).

## Status

Expand Down
34 changes: 25 additions & 9 deletions experimental/LieAlgebras/docs/src/lie_algebras.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ type has a corresponding element type.
The type parameter `C` is the element type of the coefficient ring.

```@docs
zero(::LieAlgebra{C}) where {C<:RingElement}
iszero(::LieAlgebraElem{C}) where {C<:RingElement}
dim(::LieAlgebra{C}) where {C<:RingElement}
basis(::LieAlgebra{C}) where {C<:RingElement}
basis(::LieAlgebra{C}, ::Int) where {C<:RingElement}
coefficients(::LieAlgebraElem{C}) where {C<:RingElement}
coeff(::LieAlgebraElem{C}, ::Int) where {C<:RingElement}
getindex(::LieAlgebraElem{C}, ::Int) where {C<:RingElement}
symbols(::LieAlgebra{C}) where {C<:RingElement}
zero(::LieAlgebra)
iszero(::LieAlgebraElem)
dim(::LieAlgebra)
basis(::LieAlgebra)
basis(::LieAlgebra, ::Int)
coefficients(::LieAlgebraElem)
coeff(::LieAlgebraElem, ::Int)
getindex(::LieAlgebraElem, ::Int)
symbols(::LieAlgebra)
```

## Special functions for `LinearLieAlgebra`s
Expand Down Expand Up @@ -59,6 +59,22 @@ The usual arithmetics, e.g. `+`, `-`, and `*`, are defined for `LieAlgebraElem`s
!!! warning
Please note that `*` refers to the Lie bracket and is thus not associative.

## Properties

```@docs
is_abelian(L::LieAlgebra)
is_simple(L::LieAlgebra)
```

## More functions

```@docs
derived_algebra(L::LieAlgebra)
center(L::LieAlgebra)
centralizer(L::LieAlgebra, xs::AbstractVector{<:LieAlgebraElem})
centralizer(L::LieAlgebra, x::LieAlgebraElem)
```

## Lie algebra constructors

```@docs
Expand Down
36 changes: 18 additions & 18 deletions experimental/LieAlgebras/docs/src/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ element type `LieAlgebraModuleElem{C}`.
The type parameter `C` is the element type of the coefficient ring.

```@docs
base_lie_algebra(V::LieAlgebraModule{C}) where {C<:RingElement}
zero(::LieAlgebraModule{C}) where {C<:RingElement}
iszero(::LieAlgebraModuleElem{C}) where {C<:RingElement}
dim(::LieAlgebraModule{C}) where {C<:RingElement}
basis(::LieAlgebraModule{C}) where {C<:RingElement}
basis(::LieAlgebraModule{C}, ::Int) where {C<:RingElement}
coefficients(::LieAlgebraModuleElem{C}) where {C<:RingElement}
coeff(::LieAlgebraModuleElem{C}, ::Int) where {C<:RingElement}
getindex(::LieAlgebraModuleElem{C}, ::Int) where {C<:RingElement}
symbols(::LieAlgebraModule{C}) where {C<:RingElement}
base_lie_algebra(V::LieAlgebraModule)
zero(::LieAlgebraModule)
iszero(::LieAlgebraModuleElem)
dim(::LieAlgebraModule)
basis(::LieAlgebraModule)
basis(::LieAlgebraModule, ::Int)
coefficients(::LieAlgebraModuleElem)
coeff(::LieAlgebraModuleElem, ::Int)
getindex(::LieAlgebraModuleElem, ::Int)
symbols(::LieAlgebraModule)
```

## Element constructors
Expand Down Expand Up @@ -52,7 +52,7 @@ The module action is defined as `*`.
## Module constructors

```@docs
standard_module(::LinearLieAlgebra{C}) where {C<:RingElement}
standard_module(::LinearLieAlgebra)
dual(::LieAlgebraModule{C}) where {C<:RingElement}
direct_sum(::LieAlgebraModule{C}, ::LieAlgebraModule{C}) where {C<:RingElement}
tensor_product(::LieAlgebraModule{C}, ::LieAlgebraModule{C}) where {C<:RingElement}
Expand All @@ -66,13 +66,13 @@ abstract_module(::LieAlgebra{C}, ::Int, ::Matrix{SRow{C}}, ::Vector{<:VarName};
# Type-dependent getters

```@docs
is_standard_module(::LieAlgebraModule{C}) where {C<:RingElement}
is_dual(::LieAlgebraModule{C}) where {C<:RingElement}
is_direct_sum(::LieAlgebraModule{C}) where {C<:RingElement}
is_tensor_product(::LieAlgebraModule{C}) where {C<:RingElement}
is_exterior_power(::LieAlgebraModule{C}) where {C<:RingElement}
is_symmetric_power(::LieAlgebraModule{C}) where {C<:RingElement}
is_tensor_power(::LieAlgebraModule{C}) where {C<:RingElement}
is_standard_module(::LieAlgebraModule)
is_dual(::LieAlgebraModule)
is_direct_sum(::LieAlgebraModule)
is_tensor_product(::LieAlgebraModule)
is_exterior_power(::LieAlgebraModule)
is_symmetric_power(::LieAlgebraModule)
is_tensor_power(::LieAlgebraModule)
base_module(::LieAlgebraModule{C}) where {C<:RingElement}
base_modules(::LieAlgebraModule{C}) where {C<:RingElement}
```
69 changes: 60 additions & 9 deletions experimental/LieAlgebras/src/AbstractLieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
dimL = n1
@req length(s) == dimL "Invalid number of basis element names."
if check
@req all(
r -> all(e -> parent(last(e)) === R, r), struct_consts
) "Invalid structure constants."
@req all(
iszero, struct_consts[i, i][k] for i in 1:dimL, k in 1:dimL
) "Not anti-symmetric."
Expand Down Expand Up @@ -61,24 +64,37 @@ parent_type(::Type{AbstractLieAlgebraElem{C}}) where {C<:RingElement} =

elem_type(::Type{AbstractLieAlgebra{C}}) where {C<:RingElement} = AbstractLieAlgebraElem{C}

parent(x::AbstractLieAlgebraElem{C}) where {C<:RingElement} = x.parent
parent(x::AbstractLieAlgebraElem) = x.parent

base_ring(L::AbstractLieAlgebra{C}) where {C<:RingElement} = L.R::parent_type(C)
coefficient_ring(L::AbstractLieAlgebra{C}) where {C<:RingElement} = L.R::parent_type(C)

dim(L::AbstractLieAlgebra{C}) where {C<:RingElement} = L.dim
dim(L::AbstractLieAlgebra) = L.dim

###############################################################################
#
# String I/O
#
###############################################################################

function Base.show(io::IO, V::AbstractLieAlgebra{C}) where {C<:RingElement}
print(io, "AbstractLieAlgebra over ")
print(IOContext(io, :compact => true), base_ring(V))
function Base.show(io::IO, ::MIME"text/plain", L::AbstractLieAlgebra)
io = pretty(io)
println(io, "Abstract Lie algebra")
println(io, Indent(), "of dimension $(dim(L))", Dedent())
print(io, "over ")
print(io, Lowercase(), coefficient_ring(L))
end

function symbols(L::AbstractLieAlgebra{C}) where {C<:RingElement}
function Base.show(io::IO, L::AbstractLieAlgebra)
if get(io, :supercompact, false)
print(io, "Abstract Lie algebra")
else
io = pretty(io)
print(io, "Abstract Lie algebra over ", Lowercase())
print(IOContext(io, :supercompact => true), coefficient_ring(L))
end
end

function symbols(L::AbstractLieAlgebra)
return L.s
end

Expand Down Expand Up @@ -108,14 +124,24 @@ function bracket(
return L(mat)
end

###############################################################################
#
# Properties
#
###############################################################################

function is_abelian(L::AbstractLieAlgebra)
return all(e -> iszero(length(e)), L.struct_consts)
end

###############################################################################
#
# Constructor
#
###############################################################################

@doc raw"""
lie_algebra(R::Ring, struct_consts::Matrix{SRow{C}}, s::Vector{<:VarName}; cached::Bool, check::Bool) -> AbstractLieAlgebra{elem_type(R)}
lie_algebra(R::Ring, struct_consts::Matrix{SRow{elem_type(R)}}, s::Vector{<:VarName}; cached::Bool, check::Bool) -> AbstractLieAlgebra{elem_type(R)}

Construct the Lie algebra over the ring `R` with structure constants `struct_consts`
and with basis element names `s`.
Expand All @@ -138,6 +164,7 @@ function lie_algebra(
cached::Bool=true,
check::Bool=true,
) where {C<:RingElement}
@req C == elem_type(R) "Invalid coefficient type."
return AbstractLieAlgebra{elem_type(R)}(R, struct_consts, Symbol.(s); cached, check)
end

Expand Down Expand Up @@ -175,7 +202,9 @@ julia> struct_consts[3, 2, 2] = QQ(-2);
julia> struct_consts[2, 3, 2] = QQ(2);

julia> sl2 = lie_algebra(QQ, struct_consts, ["e", "f", "h"])
AbstractLieAlgebra over Rational field
Abstract Lie algebra
of dimension 3
over rational field

julia> e, f, h = basis(sl2)
3-element Vector{AbstractLieAlgebraElem{QQFieldElem}}:
Expand All @@ -200,6 +229,7 @@ function lie_algebra(
cached::Bool=true,
check::Bool=true,
) where {C<:RingElement}
@req C == elem_type(R) "Invalid coefficient type."
struct_consts2 = Matrix{SRow{elem_type(R)}}(
undef, size(struct_consts, 1), size(struct_consts, 2)
)
Expand All @@ -212,6 +242,27 @@ function lie_algebra(
return AbstractLieAlgebra{elem_type(R)}(R, struct_consts2, Symbol.(s); cached, check)
end

function lie_algebra(
basis::Vector{AbstractLieAlgebraElem{C}}; check::Bool=true
) where {C<:RingElement}
parent_L = parent(basis[1])
@req all(parent(x) == parent_L for x in basis) "Elements not compatible."
R = coefficient_ring(parent_L)
basis_matrix = if length(basis) == 0
matrix(R, 0, dim(L), C[])
else
matrix(R, [coefficients(b) for b in basis])
end
struct_consts = Matrix{SRow{elem_type(R)}}(undef, length(basis), length(basis))
for (i, bi) in enumerate(basis), (j, bj) in enumerate(basis)
fl, row = can_solve_with_solution(basis_matrix, _matrix(bi * bj); side=:left)
@req fl "Not closed under the bracket."
struct_consts[i, j] = sparse_row(row)
end
s = map(AbstractAlgebra.obj_to_string, basis)
return lie_algebra(R, struct_consts, s; check)
end

@doc raw"""
lie_algebra(R::Ring, dynkin::Tuple{Char,Int}; cached::Bool) -> AbstractLieAlgebra{elem_type(R)}

Expand Down
6 changes: 3 additions & 3 deletions experimental/LieAlgebras/src/GapWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
################################################################################

function lie_algebra_highest_weight_module_struct_consts_gap(
L::LieAlgebra{C}, weight::Vector{Int}
) where {C<:RingElement}
R = base_ring(L)
L::LieAlgebra, weight::Vector{Int}
)
R = coefficient_ring(L)
isoR = Oscar.iso_oscar_gap(R)

gapL = codomain(Oscar.iso_oscar_gap(L))
Expand Down
Loading