Skip to content

Commit

Permalink
Make root system interface a bit clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Aug 21, 2024
1 parent 2d1c537 commit 7ea927d
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions experimental/LieAlgebras/src/LieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ abstract type LieAlgebra{C<:FieldElem} end
abstract type LieAlgebraElem{C<:FieldElem} end

# To be implemented by subtypes:
# parent_type(::Type{MyLieAlgebraElem{C}})
# elem_type(::Type{MyLieAlgebra{C}})
# parent(x::MyLieAlgebraElem{C})
# coefficient_ring(L::MyLieAlgebra{C})
# dim(L::MyLieAlgebra{C})
# Base.show(io::IO, x::MyLieAlgebra{C})
# symbols(L::MyLieAlgebra{C})
# bracket(x::MyLieAlgebraElem{C}, y::MyLieAlgebraElem{C})
# Mandatory:
# parent_type(::Type{MyLieAlgebraElem{C}}) = MyLieAlgebra{C}
# elem_type(::Type{MyLieAlgebra{C}}) = MyLieAlgebraElem{C}
# parent(x::MyLieAlgebraElem{C}) -> MyLieAlgebra{C}
# coefficient_ring(L::MyLieAlgebra{C}) -> parent_type(C)
# dim(L::MyLieAlgebra) -> Int
# symbols(L::MyLieAlgebra) -> Vector{Symbol}
# bracket(x::MyLieAlgebraElem{C}, y::MyLieAlgebraElem{C}) -> MyLieAlgebraElem{C}
# Base.show(io::IO, x::MyLieAlgebra)
# If the subtype supports root systems:
# has_root_system(::MyLieAlgebra) -> Bool
# root_system(::MyLieAlgebra) -> RootSystem
# chevalley_basis(L::MyLieAlgebra) -> NTuple{3,Vector{elem_type(L)}}

###############################################################################
#
Expand Down Expand Up @@ -447,8 +452,6 @@ end
has_root_system(L::LieAlgebra) -> Bool
Return whether a root system for `L` is known.
This function should be implemented by subtypes that support root systems.
"""
has_root_system(L::LieAlgebra) = false # to be implemented by subtypes

Expand All @@ -457,9 +460,9 @@ has_root_system(L::LieAlgebra) = false # to be implemented by subtypes
Return the root system of `L`.
This function should be implemented by subtypes that support root systems.
This function will error if no root system is known (see [`has_root_system(::LieAlgebra)`](@ref)).
"""
function root_system(L::LieAlgebra)
function root_system(L::LieAlgebra) # to be implemented by subtypes
@req has_root_system(L) "root system of `L` not known."
throw(Hecke.NotImplemented())
end
Expand All @@ -470,8 +473,10 @@ end
Return the Chevalley basis of the Lie algebra `L` in three vectors, stating first the positive root vectors,
then the negative root vectors, and finally the basis of the Cartan subalgebra. The order of root vectors corresponds
to the order of the roots in [`root_system(::LieAlgebra)`](@ref).
This function will error if no root system is known (see [`has_root_system(::LieAlgebra)`](@ref)).
"""
function chevalley_basis(L::LieAlgebra)
function chevalley_basis(L::LieAlgebra) # to be implemented by subtypes
@req has_root_system(L) "root system of `L` not known."
throw(Hecke.NotImplemented())
end
Expand Down

0 comments on commit 7ea927d

Please sign in to comment.