Skip to content

Commit

Permalink
Some progress around root systems and Weyl groups (oscar-system#4271)
Browse files Browse the repository at this point in the history
* Change `WeightLatticeElem` to have coeff vector as row

* Add right action of `WeylGroupElem`s on roots and weights

* some test simplifications

* Determine root system type on demand if skipped in constructor

* Add some more examples to docstrings

to show changes to printing in the following commits

* Adapt some printing

* Fix doctests

* Remove two constructors
  • Loading branch information
lgoettgens authored Nov 8, 2024
1 parent 266fc70 commit f2329a8
Show file tree
Hide file tree
Showing 11 changed files with 486 additions and 173 deletions.
48 changes: 43 additions & 5 deletions experimental/LieAlgebras/src/AbstractLieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ function Base.show(io::IO, mime::MIME"text/plain", L::AbstractLieAlgebra)
@show_special(io, mime, L)
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))
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, Indent(), "of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
println(io, Dedent())
end
end
println(io, Indent(), "of dimension ", dim(L), Dedent())
print(io, "over ", Lowercase(), coefficient_ring(L))
end

function Base.show(io::IO, L::AbstractLieAlgebra)
Expand All @@ -40,8 +50,18 @@ function Base.show(io::IO, L::AbstractLieAlgebra)
print(io, "Abstract Lie algebra")
else
io = pretty(io)
print(io, "Abstract Lie algebra over ", Lowercase())
print(terse(io), coefficient_ring(L))
print(io, "Abstract Lie algebra")
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, " of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
end
end
print(terse(io), " over ", Lowercase(), coefficient_ring(L))
end
end

Expand Down Expand Up @@ -256,6 +276,15 @@ via the kwarg `extraspecial_pair_signs::Vector{Bool}` to specify the concrete Li
If $(\alpha,\beta)$ is the extraspecial pair for the non-simple root `root(rs, i)`,
then $\varepsilon_{\alpha,\beta} = 1$ iff `extraspecial_pair_signs[i - n_simple_roots(rs)] = true`.
For the used notation and the definition of extraspecial pairs, see [CMT04](@cite).
# Examples
```jldoctest
julia> L = lie_algebra(QQ, root_system(:B, 4))
Abstract Lie algebra
of type B4
of dimension 36
over rational field
```
"""
function lie_algebra(
R::Field,
Expand Down Expand Up @@ -426,6 +455,15 @@ end
Construct a simple Lie algebra over the field `R` with Dynkin type given by `fam` and `rk`.
See `cartan_matrix(fam::Symbol, rk::Int)` for allowed combinations.
The internally used basis of this Lie algebra is the Chevalley basis.
# Examples
```jldoctest
julia> L = lie_algebra(QQ, :C, 4)
Abstract Lie algebra
of type C4
of dimension 36
over rational field
```
"""
function lie_algebra(R::Field, S::Symbol, n::Int)
rs = root_system(S, n)
Expand Down
27 changes: 27 additions & 0 deletions experimental/LieAlgebras/src/LieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,33 @@ end
#
###############################################################################

@doc raw"""
abelian_lie_algebra(R::Field, n::Int) -> LinearLieAlgebra{elem_type(R)}
abelian_lie_algebra(::Type{LinearLieAlgebra}, R::Field, n::Int) -> LinearLieAlgebra{elem_type(R)}
abelian_lie_algebra(::Type{AbstractLieAlgebra}, R::Field, n::Int) -> AbstractLieAlgebra{elem_type(R)}
Return the abelian Lie algebra of dimension `n` over the field `R`.
The first argument can be optionally provided to specify the type of the returned
Lie algebra.
# Example
```jldoctest
julia> abelian_lie_algebra(LinearLieAlgebra, QQ, 3)
Linear Lie algebra with 3x3 matrices
of dimension 3
over rational field
julia> abelian_lie_algebra(AbstractLieAlgebra, QQ, 3)
Abstract Lie algebra
of dimension 3
over rational field
```
"""
function abelian_lie_algebra(R::Field, n::Int)
@req n >= 0 "Dimension must be non-negative."
return abelian_lie_algebra(LinearLieAlgebra, R, n)
end

@doc raw"""
lie_algebra(gapL::GapObj, s::Vector{<:VarName}) -> LieAlgebra{elem_type(R)}
Expand Down
6 changes: 3 additions & 3 deletions experimental/LieAlgebras/src/LieAlgebraModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1445,8 +1445,8 @@ julia> dominant_weights(L, [1, 0, 3])
7-element Vector{Vector{Int64}}:
[1, 0, 3]
[1, 1, 1]
[2, 0, 1]
[0, 0, 3]
[2, 0, 1]
[0, 1, 1]
[1, 0, 1]
[0, 0, 1]
Expand Down Expand Up @@ -1509,10 +1509,10 @@ Dict{Vector{Int64}, Int64} with 10 entries:
[-1, 1, -1] => 1
[-2, 2, 0] => 1
[1, -1, 1] => 1
[-1, 0, 1] => 1
[1, 0, -1] => 1
[2, 0, 0] => 1
[-1, 0, 1] => 1
[0, -1, 0] => 1
[2, 0, 0] => 1
```
"""
function character(L::LieAlgebra, hw::Vector{<:IntegerUnion})
Expand Down
153 changes: 124 additions & 29 deletions experimental/LieAlgebras/src/LinearLieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,105 @@ function Base.show(io::IO, mime::MIME"text/plain", L::LinearLieAlgebra)
@show_name(io, L)
@show_special(io, mime, L)
io = pretty(io)
println(io, _lie_algebra_type_to_string(get_attribute(L, :type, :unknown), L.n))
println(io, Indent(), "of dimension $(dim(L))", Dedent())
type_string = _lie_algebra_type_to_string(get_attribute(L, :type, :unknown), L.n)
if !isnothing(type_string)
println(io, type_string)
else
println(io, "Linear Lie algebra with $(L.n)x$(L.n) matrices")
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, Indent(), "of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
println(io, Dedent())
end
end
end
println(io, Indent(), "of dimension ", dim(L), Dedent())
print(io, "over ", Lowercase(), coefficient_ring(L))
end

function Base.show(io::IO, L::LinearLieAlgebra)
@show_name(io, L)
@show_special(io, L)
if is_terse(io)
type_string_compact = _lie_algebra_type_to_compact_string(
get_attribute(L, :type, :unknown), L.n
)
if !isnothing(type_string_compact)
print(io, type_string_compact)
else
print(io, "Linear Lie algebra")
end
else
io = pretty(io)
type_string = _lie_algebra_type_to_string(get_attribute(L, :type, :unknown), L.n)
if !isnothing(type_string)
print(io, type_string)
else
print(io, "Linear Lie algebra with $(L.n)x$(L.n) matrices")
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, " of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
end
end
end
print(terse(io), " over ", Lowercase(), coefficient_ring(L))
end
end

#=
function Base.show(io::IO, mime::MIME"text/plain", L::AbstractLieAlgebra)
@show_name(io, L)
@show_special(io, mime, L)
io = pretty(io)
println(io, "Abstract Lie algebra")
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, Indent(), "of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
println(io, Dedent())
end
end
println(io, Indent(), "of dimension ", dim(L), Dedent())
print(io, "over ")
print(io, Lowercase(), coefficient_ring(L))
end
function Base.show(io::IO, L::LinearLieAlgebra)
function Base.show(io::IO, L::AbstractLieAlgebra)
@show_name(io, L)
@show_special(io, L)
if is_terse(io)
print(io, _lie_algebra_type_to_compact_string(get_attribute(L, :type, :unknown), L.n))
print(io, "Abstract Lie algebra")
else
io = pretty(io)
print(
io,
_lie_algebra_type_to_string(get_attribute(L, :type, :unknown), L.n),
" over ",
Lowercase(),
)
print(terse(io), coefficient_ring(L))
print(io, "Abstract Lie algebra")
if has_root_system(L)
rs = root_system(L)
if has_root_system_type(rs)
type, ord = root_system_type_with_ordering(rs)
print(io, " of type ", _root_system_type_string(type))
if !issorted(ord)
print(io, " (non-canonical ordering)")
end
end
end
print(terse(io), " over ", Lowercase(), coefficient_ring(L))
end
end
=#

function _lie_algebra_type_to_string(type::Symbol, n::Int)
if type == :general_linear
Expand All @@ -76,9 +153,8 @@ function _lie_algebra_type_to_string(type::Symbol, n::Int)
return "Special orthogonal Lie algebra of degree $n"
elseif type == :symplectic
return "Symplectic Lie algebra of degree $n"
else
return "Linear Lie algebra with $(n)x$(n) matrices"
end
return nothing
end

function _lie_algebra_type_to_compact_string(type::Symbol, n::Int)
Expand All @@ -88,9 +164,8 @@ function _lie_algebra_type_to_compact_string(type::Symbol, n::Int)
return "sl_$n"
elseif type == :special_orthogonal
return "so_$n"
else
return "Linear Lie algebra"
end
return nothing
end

function symbols(L::LinearLieAlgebra)
Expand Down Expand Up @@ -188,6 +263,40 @@ given by `s`. The basis elements must be square matrices of size `n`.
We require `basis` to be linearly independent, and to contain the Lie bracket of any
two basis elements in its span (this is currently not checked).
Setting `check=false` disables these checks (once they are in place).
# Examples
```jldoctest
julia> e = matrix(QQ, [0 0 1; 0 0 0; 0 0 0]);
julia> f = matrix(QQ, [0 0 0; 0 0 0; 1 0 0]);
julia> h = matrix(QQ, [1 0 0; 0 0 0; 0 0 -1]);
julia> L = lie_algebra(QQ, 3, [e, f, h], [:e, :f, :h])
Linear Lie algebra with 3x3 matrices
of dimension 3
over rational field
julia> root_system(L);
julia> L
Linear Lie algebra with 3x3 matrices
of type A1
of dimension 3
over rational field
julia> basis(L)
3-element Vector{LinearLieAlgebraElem{QQFieldElem}}:
e
f
h
julia> matrix_repr_basis(L)
3-element Vector{QQMatrix}:
[0 0 1; 0 0 0; 0 0 0]
[0 0 0; 0 0 0; 1 0 0]
[1 0 0; 0 0 0; 0 0 -1]
```
"""
function lie_algebra(
R::Field,
Expand Down Expand Up @@ -215,20 +324,6 @@ function lie_algebra(
return lie_algebra(R, L.n, matrix_repr.(basis), s; check)
end

@doc raw"""
abelian_lie_algebra(R::Field, n::Int) -> LinearLieAlgebra{elem_type(R)}
abelian_lie_algebra(::Type{LinearLieAlgebra}, R::Field, n::Int) -> LinearLieAlgebra{elem_type(R)}
abelian_lie_algebra(::Type{AbstractLieAlgebra}, R::Field, n::Int) -> AbstractLieAlgebra{elem_type(R)}
Return the abelian Lie algebra of dimension `n` over the field `R`.
The first argument can be optionally provided to specify the type of the returned
Lie algebra.
"""
function abelian_lie_algebra(R::Field, n::Int)
@req n >= 0 "Dimension must be non-negative."
return abelian_lie_algebra(LinearLieAlgebra, R, n)
end

function abelian_lie_algebra(::Type{T}, R::Field, n::Int) where {T<:LinearLieAlgebra}
@req n >= 0 "Dimension must be non-negative."
basis = [(b = zero_matrix(R, n, n); b[i, i] = 1; b) for i in 1:n]
Expand Down
Loading

0 comments on commit f2329a8

Please sign in to comment.