Skip to content

Commit

Permalink
LieAlgebras: Add is_welldefined for Lie algebra homs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Sep 1, 2023
1 parent 84c42a8 commit 7776c60
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
18 changes: 15 additions & 3 deletions experimental/LieAlgebras/src/LieAlgebraHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
h.matrix = mat::dense_matrix_type(coefficient_ring(L2))
h.header = MapHeader(L1, L2)
if check
for x1 in basis(L1), x2 in basis(L1)
@req h(x1) * h(x2) == h(x1 * x2) "Not a homomorphism"
end
@req is_welldefined(h) "Not a homomorphism"
end
return h
end
Expand All @@ -51,6 +49,20 @@ function matrix(h::LieAlgebraHom{<:LieAlgebra,<:LieAlgebra{C2}}) where {C2<:Ring
return (h.matrix)::dense_matrix_type(C2)
end

@doc raw"""
is_welldefined(h::LieAlgebraHom) -> Bool
Return `true` if `h` is a well-defined homomorphism of Lie algebras.
This function is used internally when calling `hom` with `check=true`.
"""
function is_welldefined(h::LieAlgebraHom)
L1 = domain(h)
for x1 in basis(L1), x2 in basis(L1)
h(x1) * h(x2) == h(x1 * x2) || return false
end
return true
end

###############################################################################
#
# String I/O
Expand Down
8 changes: 3 additions & 5 deletions experimental/LieAlgebras/test/LieAlgebraHom-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
@test domain(h) == L1
@test codomain(h) == L2
@test matrix(h) == matrix(QQ, [0 1 0 0; 0 0 1 0; 1 0 0 -1])
for x1 in basis(L1)
for x2 in basis(L1)
@test h(x1 * x2) == h(x1) * h(x2)
end
end
@test is_welldefined(h)
end

@testset "Image and kernel" begin
Expand Down Expand Up @@ -45,6 +41,7 @@
@test domain(h) == L1
@test codomain(h) == L1
@test matrix(h) == identity_matrix(QQ, dim(L1))
@test is_welldefined(h)
for x in basis(L1)
@test h(x) == x
end
Expand All @@ -55,6 +52,7 @@
@test domain(h) == L1
@test codomain(h) == L2
@test matrix(h) == zero_matrix(QQ, dim(L1), dim(L2))
@test is_welldefined(h)
for x in basis(L1)
@test h(x) == zero(L2)
end
Expand Down
29 changes: 29 additions & 0 deletions experimental/LieAlgebras/test/LieAlgebraModuleHom-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,35 @@
@test image(h, v6) == h(v6) == v3
end

@testset "Identity and zero map" begin
L = special_linear_lie_algebra(QQ, 3)
stdV = standard_module(L)
V1 = symmetric_power(stdV, 3)
V2 = exterior_power(stdV, 2)

h = identity_map(V1)
@test domain(h) == V1
@test codomain(h) == V1
@test matrix(h) == identity_matrix(QQ, dim(V1))
@test is_welldefined(h)
for v in basis(V1)
@test h(v) == v
end
# @test image(h) == ...
# @test kernel(h) == ...

h = zero_map(V1, V2)
@test domain(h) == V1
@test codomain(h) == V2
@test matrix(h) == zero_matrix(QQ, dim(V1), dim(V2))
@test is_welldefined(h)
for v in basis(V1)
@test h(v) == zero(V2)
end
# @test image(h) == ...
# @test kernel(h) == ...
end

@testset "Composition" begin
L = special_orthogonal_lie_algebra(QQ, 3)
V1 = standard_module(L)
Expand Down

0 comments on commit 7776c60

Please sign in to comment.