Skip to content

Commit

Permalink
Experimental: Add BasisLieHighestWeight (#2936)
Browse files Browse the repository at this point in the history
* Code from BasisLieHighestWeight, Pull request #2115

* Removed part of fromGap, gens(ZZx) instaed of x

* Simplified paramters with structures and recomputation

* TODOs

* Added test-files, removed TVec

* Removed nullSpace()

* VectorSpaceBases-test.jl

* NewMonomial-test.jl

* compute_sub_weights

* Added GAPWrap instead of GAP.Globals where possible

* Custom print functions for the structures

* tabs to indents

* Doctest basis_lie_highest_weight

* Changed get_monomial_order_lt to accept name of monomial-order as defined in Oscar.jl

* function body of special basis_lie_highest_weight functions

* .

* DemazureOperators

* demazure_operators_summary

* oplex_lt

* Bugfix ZZ(0) in result instead of ZZ(1)

* Comments

* Bugfix demazure_operator order of operators

* Root Conversion with QQ

* RootConversion-test and -data

* Bugfix rootconverison A

* Bugfix root-conversion D

* Bugfix root-conversion F

* Bugfix root-conversion E8

* CalculateBetas, CalculateBetas-test

* root_to_root_vector

* compute_operators_lustzig_nz

* Operators as Julia-vectors, find_root_in_chevalley_basis

* basis_lie_highest_weight_lustzig

* Docstring and adapted methods for lustzig, nz, fflv, string

* Print Birational-sequence with alpha_i

* Word-calculations only for lustzig

* Remove Documenter.jl as dep

* Run JuliaFormatter

* Fix root conversion

* Make tests green

* Make RootConversion tests faster

* Use lowercase constructors

* Refactor root conversion

* Remove workaround for old issues

* Move some stuff around

* Change dynkin type to symbol

* Fix doctests

* Add basic docs

* Excise uses of `gap_to_julia` and `julia_to_gap`

* Enhance printing of output

* Remove `cache_size`

* Remove lots of unused code

* Bugfix: Reverse operator list for FFLV

* User can input reduced expression through sum of roots instead of searching through GAP list

* Refactor polyhedral code

* Change `get_lattice_points_of_weightspace` to accept input in alpha_i

* Excise all uses of weights in eps_i basis

* Change monomial ordering inputs to symbols

* `order` -> `ordering`

* Refactor passing around lie_algebra

* Move user facing functions to separate file

* Adapt input to Ghislain's whishes

* Make weighted orderings work

* Add function to print operators

* Replace all uses of `convert`

* Refactor algorithm input and some Lie algebra stuff

- completely rewrite operator generation (by index, by coeffs of simple roots, lustzig)
- more accessors for Lie algebra data
- remove some type conversions
- rename all vars `lie_algebra` to avoid shadowing of function
- Update user functions' arguments to Ghislain's whishes

* More random refactoring

* More monomial ordering changes

* Excise `SparseVectorSpaceBasis`

* Fix spelling [skip ci]

* `isweighted` -> `_is_weighted`

* Fix doctests

* Skip sorting of monomials

* Fix printing

* Fix deprecation warning

* Add docstrings to `UserFunctions.jl`

* Add tests against Xin's output

* Remove unnecessary printings

* Add exports

* Adjust printing to Ghislain's whishes

* Apply suggestions from code review

Co-authored-by: Ghislain Fourier <[email protected]>

* Fix typo in printing

* Fix visibility issue

* Add all documented functions to docs

---------

Co-authored-by: Ben Wilop <[email protected]>
Co-authored-by: Ghislain Fourier <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2023
1 parent 43ef558 commit e6842c0
Show file tree
Hide file tree
Showing 19 changed files with 2,209 additions and 0 deletions.
6 changes: 6 additions & 0 deletions experimental/BasisLieHighestWeight/docs/doc.main
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"Bases for highest weight modules" => [
"introduction.md",
"user_functions.md"
]
]
25 changes: 25 additions & 0 deletions experimental/BasisLieHighestWeight/docs/src/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```@meta
CurrentModule = Oscar
DocTestSetup = quote
using Oscar
end
```

# Introduction

This subproject contains the code for the OSCAR book chapter by Ghislain Fourier and Xin Fang on the bases of highest weight modules.

## Status

This part of OSCAR is in an experimental state; please see [Adding new projects to experimental](@ref) for what this means.
More documentation is to come in the future.

## Contact

Please direct questions about this part of OSCAR to the following people:
* [Ghislain Fourier](https://www.art.rwth-aachen.de/cms/~rnko/)
* [Lars Göttgens](https://lgoe.li/)

You can ask questions in the [OSCAR Slack](https://www.oscar-system.org/community/#slack).

Alternatively, you can [raise an issue on github](https://www.oscar-system.org/community/#how-to-report-issues).
16 changes: 16 additions & 0 deletions experimental/BasisLieHighestWeight/docs/src/user_functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```@meta
CurrentModule = Oscar
DocTestSetup = quote
using Oscar
end
```

# User-facing functions
```@docs
basis_lie_highest_weight_operators
basis_lie_highest_weight
basis_lie_highest_weight_lusztig
basis_lie_highest_weight_nz
basis_lie_highest_weight_pbw
basis_lie_highest_weight_string
```
59 changes: 59 additions & 0 deletions experimental/BasisLieHighestWeight/src/BasisLieHighestWeight.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module BasisLieHighestWeight

using ..Oscar
using ..Oscar: GAPWrap, IntegerUnion, _is_weighted

using AbstractAlgebra.PrettyPrinting

import Oscar: dim, monomial_ordering, monomials

import Base: length

# TODO: Test if ZZx should be a graded_polynomial_ring with weights_w as weights

# TODO (?) Maybe export and docstring:
# get_dim_weightspace
# orbit_weylgroup
# get_lattice_points_of_weightspace
# convert_lattice_points_to_monomials
# convert_monomials_to_lattice_points
# action_matrices_of_operators
# weights_for_operators

# TODO Use Oscar-Lie-Algebra type instead of LieAlgebra
# TODO Data-Type for weights of Lie-Algebras? Two types, in alpha_i and w_i, conversion is defined in RootConversion
# w_to_aplha
# alpha_to_w

# TODO GAPWrap-wrappers are missing

include("LieAlgebras.jl")
include("BirationalSequence.jl")
include("MonomialBasis.jl")
include("NewMonomial.jl")
include("TensorModels.jl")
include("MonomialOrder.jl")
include("RootConversion.jl")
include("WeylPolytope.jl")
include("MainAlgorithm.jl")
include("UserFunctions.jl")

export basis_lie_highest_weight_operators
export basis_lie_highest_weight
export basis_lie_highest_weight_lusztig
export basis_lie_highest_weight_nz
export basis_lie_highest_weight_pbw
export basis_lie_highest_weight_string

end

using .BasisLieHighestWeight

export BasisLieHighestWeight

export basis_lie_highest_weight_operators
export basis_lie_highest_weight
export basis_lie_highest_weight_lusztig
export basis_lie_highest_weight_nz
export basis_lie_highest_weight_pbw
export basis_lie_highest_weight_string
12 changes: 12 additions & 0 deletions experimental/BasisLieHighestWeight/src/BirationalSequence.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
struct BirationalSequence
operators::Vector{GAP.Obj}
operators_vectors::Vector{Vector{Any}}
weights_w::Vector{Vector{ZZRingElem}}
weights_alpha::Vector{Vector{QQFieldElem}}
end

function Base.show(io::IO, birational_sequence::BirationalSequence)
println(io, "BirationalSequence")
println(io, "Operators: ", birational_sequence.operators)
print(io, "Weights in alpha_i:", birational_sequence.weights_alpha)
end
83 changes: 83 additions & 0 deletions experimental/BasisLieHighestWeight/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
@attributes mutable struct LieAlgebraStructure
lie_type::Symbol
rank::Int
lie_algebra_gap::GAP.Obj
chevalley_basis::NTuple{3,Vector{GAP.Obj}}

function LieAlgebraStructure(lie_type::Symbol, rank::Int)
lie_algebra_gap = GAP.Globals.SimpleLieAlgebra(
GAP.Obj(lie_type), rank, GAP.Globals.Rationals
)
chevalley_basis = NTuple{3,Vector{GAP.Obj}}(GAP.Globals.ChevalleyBasis(lie_algebra_gap))
return new(lie_type, rank, lie_algebra_gap, chevalley_basis)
end
end

rank(L::LieAlgebraStructure) = L.rank

@attr QQMatrix function cartan_matrix(L::LieAlgebraStructure)
R = GAP.Globals.RootSystem(L.lie_algebra_gap)
C = matrix(QQ, GAP.Globals.CartanMatrix(R))
return C
end

@attr QQMatrix function inv_cartan_matrix(L::LieAlgebraStructure)
return inv(cartan_matrix(L))
end

function Base.show(io::IO, L::LieAlgebraStructure)
io = pretty(io)
print(io, LowercaseOff(), "Lie algebra of type $(L.lie_type)$(L.rank)")
end

function lie_algebra(type::Symbol, rk::Int)
return LieAlgebraStructure(type, rk)
end

function chevalley_basis_gap(L::LieAlgebraStructure)
return L.chevalley_basis
end

function cartan_sub_basis(L::LieAlgebraStructure)
return L.chevalley_basis[3]
end

function root_system_gap(L::LieAlgebraStructure)
return GAP.Globals.RootSystem(L.lie_algebra_gap)
end

function num_positive_roots(L::LieAlgebraStructure)
return length(GAP.Globals.PositiveRoots(root_system_gap(L)))
end

function matrices_of_operators_gap(
L::LieAlgebraStructure, highest_weight::Vector{ZZRingElem}, operators::Vector{GAP.Obj}
)
"""
used to create action_matrices_of_operators
"""
M = GAP.Globals.HighestWeightModule(L.lie_algebra_gap, GAP.Obj(Int.(highest_weight)))
matrices_of_operators = [
sparse_matrix(transpose(matrix(QQ, GAP.Globals.MatrixOfAction(GAPWrap.Basis(M), o)))) # TODO: remove transpose?
for o in operators
]
denominators = map(y -> denominator(y[2]), union(union(matrices_of_operators...)...))
common_denominator = lcm(denominators)# // 1
matrices_of_operators =
(A -> change_base_ring(ZZ, common_denominator * A)).(matrices_of_operators)
return matrices_of_operators
end

function weight(L::LieAlgebraStructure, operator::GAP.Obj)
"""
Calculates the weight in w_i for operator
"""
@req !iszero(operator) "Operators should be non-zero"
basis = GAP.Globals.Basis(L.lie_algebra_gap)
basis_ind = GAP.Globals.Position(basis, operator)
denom = GAP.Globals.Coefficients(basis, operator)[basis_ind]
return [
ZZ(GAP.Globals.Coefficients(basis, h * operator)[basis_ind]//denom) for
h in cartan_sub_basis(L)
]
end
Loading

0 comments on commit e6842c0

Please sign in to comment.