Skip to content

Commit

Permalink
Fix some nasty bugs in GAP conversion
Browse files Browse the repository at this point in the history
that only happen if an Oscar root system is known, and the Chevalley basis is different from the basis
  • Loading branch information
lgoettgens committed Feb 5, 2025
1 parent 8e61ff2 commit 97b8f0d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
19 changes: 9 additions & 10 deletions experimental/LieAlgebras/src/iso_oscar_gap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function _iso_oscar_gap_lie_algebra_functions(
LO::LieAlgebra{C}, LG::GapObj, coeffs_iso::MapFromFunc
) where {C<:FieldElem}
basis_LG = GAPWrap.Basis(LG)
basis_LG = GAPWrap.Basis(LG, GAPWrap.GeneratorsOfAlgebra(LG))

f = function (x::LieAlgebraElem{C})
cfs = GAP.Obj([coeffs_iso(c) for c in coefficients(x)])
Expand All @@ -34,8 +34,7 @@ function _iso_oscar_gap(LO::LinearLieAlgebra; set_attributes::Bool=true)

if set_attributes && has_root_system(LO)
# we need to construct the root system in GAP as otherwise it may detect a different order of simple roots
RO = root_system(LO)
_iso_oscar_gap_set_root_system(LG, RO)
_iso_oscar_gap_set_root_system(LO, LG, f)
end

return MapFromFunc(LO, LG, f, finv)
Expand Down Expand Up @@ -64,14 +63,14 @@ function _iso_oscar_gap(LO::AbstractLieAlgebra; set_attributes::Bool=true)

if set_attributes && has_root_system(LO)
# we need to construct the root system in GAP as otherwise it may detect a different order of simple roots
RO = root_system(LO)
_iso_oscar_gap_set_root_system(LG, RO)
_iso_oscar_gap_set_root_system(LO, LG, f)
end

return MapFromFunc(LO, LG, f, finv)
end

function _iso_oscar_gap_set_root_system(LG::GapObj, RO::RootSystem)
function _iso_oscar_gap_set_root_system(LO::LieAlgebra, LG::GapObj, LO_to_LG::Function)
RO = root_system(LO)
RG = GAP.Globals.Objectify(
GAP.Globals.NewType(
GAP.Globals.NewFamily(GAP.Obj("RootSystemFam"), GAP.Globals.IsObject),
Expand All @@ -84,10 +83,10 @@ function _iso_oscar_gap_set_root_system(LG::GapObj, RO::RootSystem)
GAP.Globals.SetPositiveRoots(RG, GAP.Obj(transform_root.(positive_roots(RO))))
GAP.Globals.SetNegativeRoots(RG, GAP.Obj(transform_root.(negative_roots(RO))))
GAP.Globals.SetSimpleSystem(RG, GAP.Obj(transform_root.(simple_roots(RO))))
can_basisG = GAP.Globals.CanonicalBasis(LG)
pos_root_vectorsG = can_basisG[1:n_positive_roots(RO)]
neg_root_vectorsG = can_basisG[(n_positive_roots(RO) + 1):(2 * n_positive_roots(RO))]
csa_basisG = can_basisG[(2 * n_positive_roots(RO) + 1):end]
chev_basisL = chevalley_basis(LO)
pos_root_vectorsG = GAP.Obj(LO_to_LG.(chev_basisL[1]))
neg_root_vectorsG = GAP.Obj(LO_to_LG.(chev_basisL[2]))
csa_basisG = GAP.Obj(LO_to_LG.(chev_basisL[3]))
GAP.Globals.SetPositiveRootVectors(RG, pos_root_vectorsG)
GAP.Globals.SetNegativeRootVectors(RG, neg_root_vectorsG)
GAP.Globals.SetCanonicalGenerators(
Expand Down
11 changes: 9 additions & 2 deletions experimental/LieAlgebras/test/LieAlgebraModule-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
L = special_linear_lie_algebra(QQ, 2)
V = trivial_module(L, 0)
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 0
end

@testset "3-dim trivial module of so_3(QQ)" begin
L = special_orthogonal_lie_algebra(QQ, 2)
V = trivial_module(L, 3)
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 3
end

@testset "V of sl_2(QQ) using structure constants" begin
Expand All @@ -25,30 +27,35 @@
L = special_linear_lie_algebra(QQ, 2)
V = abstract_module(L, 2, sc)
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 2
end

@testset "λ = [1,1,0] of sl_4(QQ)" begin
L = special_linear_lie_algebra(QQ, 4)
V = simple_module(L, [1, 1, 0])
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 20
end

@testset "λ = [1,1,0,0] of so_4(CF(4))" begin
@testset "λ = [1,1] of so_4(CF(4))" begin
L = special_orthogonal_lie_algebra(cyclotomic_field(4)[1], 4)
V = simple_module(L, [1, 1, 0, 0])
V = simple_module(L, [1, 1])
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 4
end

@testset "λ = [0,1] of A_2(QQ)" begin
L = lie_algebra(QQ, :A, 2)
V = simple_module(L, [0, 1])
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 3
end

@testset "λ = [0,1,1] of B_3(QQ)" begin
L = lie_algebra(QQ, :B, 3)
V = simple_module(L, [0, 1, 1])
lie_algebra_module_conformance_test(L, V)
@test dim(V) == 112
end

@testset "V of sl_4(QQ)" begin
Expand Down
4 changes: 3 additions & 1 deletion experimental/LieAlgebras/test/iso_oscar_gap-test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Oscar: GAPWrap

function test_iso_oscar_gap(LO::LieAlgebra; num_random_tests::Int=10)
function test_iso_oscar_gap(LO::LieAlgebra; num_random_tests::Int=25)
iso = Oscar.iso_oscar_gap(LO)
@test domain(iso) === LO
LG = codomain(iso)
Expand Down Expand Up @@ -54,6 +54,7 @@ end
lie_algebra(RO, sl2_struct_consts(RO), ["e", "f", "h"]),
lie_algebra(RO, :A, 3),
lie_algebra(RO, :B, 2),
(L0 = lie_algebra(RO, :B, 5); root_system(L0); L0),
]

@testset for LO in lie_algebras
Expand All @@ -67,6 +68,7 @@ end
special_linear_lie_algebra(RO, 3),
special_orthogonal_lie_algebra(RO, 4),
symplectic_lie_algebra(RO, 6),
(LO = special_linear_lie_algebra(RO, 4); root_system(LO); LO),
]

@testset for LO in lie_algebras
Expand Down
1 change: 1 addition & 0 deletions src/GAP/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ GAP.@wrap FreeGroupOfFpGroup(x::GapObj)::GapObj
GAP.@wrap FusionCharTableTom(x::GapObj, y::GapObj)::GapObj
GAP.@wrap FusionConjugacyClasses(x::GapObj, y::GapObj)::GapObj
GAP.@wrap GaloisCyc(x::GAP.Obj, GapInt)::GAP.Obj
GAP.@wrap GeneratorsOfAlgebra(x::GapObj)::GapObj
GAP.@wrap GeneratorsOfField(x::GapObj)::GapObj
GAP.@wrap GeneratorsOfGroup(x::GapObj)::GapObj
GAP.@wrap GenExpList(x::GapObj)::GapObj
Expand Down

0 comments on commit 97b8f0d

Please sign in to comment.