From 746ac41432e0c9194f2ab50f5675fe258f4ecdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 20 Aug 2024 15:00:54 +0200 Subject: [PATCH] Move `dim_of_simple_module` to the root system --- .../LieAlgebras/src/LieAlgebraModule.jl | 15 ++---- experimental/LieAlgebras/src/LieAlgebras.jl | 1 + experimental/LieAlgebras/src/RootSystem.jl | 50 +++++++++++++++++++ .../LieAlgebras/test/LieAlgebraModule-test.jl | 4 +- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/experimental/LieAlgebras/src/LieAlgebraModule.jl b/experimental/LieAlgebras/src/LieAlgebraModule.jl index d1e01ba54740..6aa80ec27a2b 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModule.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModule.jl @@ -1429,7 +1429,8 @@ end @doc raw""" dim_of_simple_module([T = Int], L::LieAlgebra{C}, hw::Vector{<:IntegerUnion}) -> T -Computes the dimension of the simple module of the Lie algebra `L` with highest weight `hw`. +Compute the dimension of the simple module of the Lie algebra `L` with highest weight `hw` + using Weyl's dimension formula. The return value is of type `T`. # Example @@ -1441,19 +1442,11 @@ julia> dim_of_simple_module(L, [1, 1, 1]) ``` """ function dim_of_simple_module(T::Type, L::LieAlgebra, hw::Vector{<:IntegerUnion}) - @req is_dominant_weight(hw) "Not a dominant weight." if has_root_system(L) R = root_system(L) - rho = weyl_vector(R) - hw_rho = WeightLatticeElem(R, hw) + rho - num = one(ZZ) - den = one(ZZ) - for alpha in positive_roots(R) - num *= ZZ(dot(hw_rho, alpha)) - den *= ZZ(dot(rho, alpha)) - end - return T(div(num, den)) + return dim_of_simple_module(T, R, hw) else # TODO: remove branch once root system detection is implemented + @req is_dominant_weight(hw) "Not a dominant weight." return T( GAPWrap.DimensionOfHighestWeightModule( codomain(Oscar.iso_oscar_gap(L)), GAP.Obj(hw; recursive=true) diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index 1fa023704c07..e5c62c46891b 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -56,6 +56,7 @@ import ..Oscar: inv, is_abelian, is_finite, + is_integral, is_isomorphism, is_nilpotent, is_perfect, diff --git a/experimental/LieAlgebras/src/RootSystem.jl b/experimental/LieAlgebras/src/RootSystem.jl index 20c8b732bfe9..d428004793eb 100644 --- a/experimental/LieAlgebras/src/RootSystem.jl +++ b/experimental/LieAlgebras/src/RootSystem.jl @@ -883,6 +883,10 @@ function is_dominant(w::WeightLatticeElem) return all(>=(0), coefficients(w)) end +function is_integral(w::WeightLatticeElem) + return all(is_integer, coefficients(w)) +end + @doc raw""" reflect(w::WeightLatticeElem, s::Int) -> WeightLatticeElem @@ -906,6 +910,9 @@ function root_system(w::WeightLatticeElem) return w.root_system end +############################################################################### +# more functions + function dot(r::RootSpaceElem, w::WeightLatticeElem) @req root_system(r) === root_system(w) "parent root system mismatch" @@ -920,6 +927,49 @@ function dot(w::WeightLatticeElem, r::RootSpaceElem) return dot(r, w) end +@doc raw""" + dim_of_simple_module([T = Int], R::RootSystem, hw::WeightLatticeElem -> T + dim_of_simple_module([T = Int], R::RootSystem, hw::Vector{<:IntegerUnion}) -> T + +Compute the dimension of the simple module of the Lie algebra defined by the root system `R` +with highest weight `hw` using Weyl's dimension formula. +The return value is of type `T`. + +# Example +```jldoctest +julia> R = root_system(:B, 2); + +julia> dim_of_simple_module(R, [1, 0]) +5 +``` +""" +function dim_of_simple_module(T::Type, R::RootSystem, hw::WeightLatticeElem) + @req root_system(hw) === R "parent root system mismatch" + @req is_dominant(hw) "not a dominant weight" + @req is_integral(hw) "not an integral weight" + rho = weyl_vector(R) + hw_rho = hw + rho + num = one(ZZ) + den = one(ZZ) + for alpha in positive_roots(R) + num *= ZZ(dot(hw_rho, alpha)) + den *= ZZ(dot(rho, alpha)) + end + return T(div(num, den)) +end + +function dim_of_simple_module(T::Type, R::RootSystem, hw::Vector{<:IntegerUnion}) + return dim_of_simple_module(T, R, WeightLatticeElem(R, hw)) +end + +function dim_of_simple_module(R::RootSystem, hw::Vector{<:IntegerUnion}) + return dim_of_simple_module(Int, R, hw) +end + +function dim_of_simple_module(R::RootSystem, hw::WeightLatticeElem) + return dim_of_simple_module(Int, R, hw) +end + ############################################################################### # internal helpers diff --git a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl index 433eae1e592c..f96aa25a4510 100644 --- a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl +++ b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl @@ -719,9 +719,9 @@ @test dim == 393513120 end - let L = lie_algebra(QQ, :B, 7) + let R = root_system(:B, 7) dim = @inferred dim_of_simple_module( - ZZRingElem, L, [7, 2, 5, 1, 0, 2, 6] + ZZRingElem, R, [7, 2, 5, 1, 0, 2, 6] ) @test dim isa ZZRingElem @test dim == 307689492858882008424585750