Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LieAlgebras: Change WeylGroup action to a right action #4374

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions experimental/BasisLieHighestWeight/src/MainAlgorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function operators_lusztig(L::LieAlgebra, reduced_expression::Vector{Int})
# Computes the operators for the lusztig polytopes for a longest weyl-word
# reduced_expression.

# \beta_k := s_{i_1} … s_{i_{k-1}} (\alpha_{i_k})
# \beta_k := (\alpha_{i_k}) s_{i_{k-1}} … s_{i_1}

# F.e. for A, 2, [1, 2, 1], we get
# \beta_1 = \alpha_1
Expand All @@ -465,7 +465,7 @@ function operators_lusztig(L::LieAlgebra, reduced_expression::Vector{Int})
R = root_system(L)
W = weyl_group(R)
operators = map(1:length(reduced_expression)) do k
root = W(reduced_expression[1:(k - 1)]) * simple_root(R, reduced_expression[k])
root = simple_root(R, reduced_expression[k]) * W(reduced_expression[(k - 1):-1:1])
fl = is_positive_root(root)
@req fl "Only positive roots may occur here"
root
Expand Down
2 changes: 1 addition & 1 deletion experimental/BasisLieHighestWeight/src/UserFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ for a simple Lie algebra $L$ of type `type_rank`.

Let $\omega_0 = s_{i_1} \cdots s_{i_N}$ be a reduced expression of the longest element in the Weyl group of $L$
given as indices $[i_1, \dots, i_N]$ in `reduced_expression`.
Then the birational sequence used consists of $\beta_1, \dots, \beta_N$ where $\beta_1 := \alpha_{i_1}$ and \beta_k := s_{i_1} \cdots s_{i_{k-1}} \alpha_{i_k}$ for $k = 2, \dots, N$.
Then the birational sequence used consists of $\beta_1, \dots, \beta_N$ where $\beta_1 := \alpha_{i_1}$ and \beta_k := \alpha_{i_k} s_{i_{k-1}} \cdots s_{i_1}$ for $k = 2, \dots, N$.

The monomial ordering is fixed to `wdegrevlex` (weighted degree reverse lexicographic order).

Expand Down
8 changes: 3 additions & 5 deletions experimental/LieAlgebras/docs/src/weyl_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ DocTestSetup = Oscar.doctestsetup()
Weyl groups are represented by objects of type `WeylGroup <: Group`, and their elements by `WeylGroupElem <: GroupElement`.

!!! warning
Weyl groups in OSCAR afford both left and right actions on roots and weights.
Note however, that **the left action** is the default (to align with the literature),
and all more complex functionality is defined with respect to the left action, e.g.
[`conjugate_dominant_weight_with_elem(::WeightLatticeElem)`](@ref).
Weyl groups in OSCAR only afford **right** actions on roots and weights.
Note however, that this may differ from the literature, but is to stay
consistent with the conventions in the rest of OSCAR.

## Table of contents

Expand Down Expand Up @@ -82,7 +81,6 @@ reduced_expressions(::WeylGroupElem)
## Action on roots and weights

```@docs
*(::WeylGroupElem, ::Union{RootSpaceElem,WeightLatticeElem})
*(::Union{RootSpaceElem,WeightLatticeElem}, ::WeylGroupElem)
```

Expand Down
4 changes: 2 additions & 2 deletions experimental/LieAlgebras/src/LieAlgebraModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ end
demazure_character([T = Int], L::LieAlgebra, w::Vector{<:IntegerUnion}, reduced_expr::Vector{<:IntegerUnion}) -> Dict{WeightLatticeElem, T}

Computes all weights occurring in the Demazure module of the Lie algebra `L``
with extremal weight `x*w`, together with their multiplicities.
with extremal weight `w * x`, together with their multiplicities.

Instead of a Weyl group element `x`, a reduced expression for `x` can be supplied.
This function may return arbitrary results if the provided expression is not reduced.
Expand All @@ -1603,7 +1603,7 @@ This function may return arbitrary results if the provided expression is not red
```jldoctest
julia> L = lie_algebra(QQ, :A, 2);

julia> demazure_character(L, [1, 1], [1, 2])
julia> demazure_character(L, [1, 1], [2, 1])
Dict{WeightLatticeElem, Int64} with 5 entries:
2*w_1 - w_2 => 1
w_1 + w_2 => 1
Expand Down
8 changes: 4 additions & 4 deletions experimental/LieAlgebras/src/RootSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ function _action_matrices_on_weights(W::WeylGroup)
return map(1:rank(R)) do i
x = gen(W, i)
matrix(
ZZ, reduce(vcat, coefficients(x * fundamental_weight(R, j)) for j in 1:rank(R))
ZZ, reduce(vcat, coefficients(fundamental_weight(R, j) * x) for j in 1:rank(R))
)
end
end
Expand Down Expand Up @@ -1840,7 +1840,7 @@ end
demazure_character([T = Int], R::RootSystem, w::Vector{<:IntegerUnion}, reduced_expr::Vector{<:IntegerUnion}) -> Dict{WeightLatticeElem, T}

Computes all weights occurring in the Demazure module of the Lie algebra defined by the root system `R`
with extremal weight `x*w`, together with their multiplicities.
with extremal weight `w * x`, together with their multiplicities.

Instead of a Weyl group element `x`, a reduced expression for `x` can be supplied.
This function may return arbitrary results if the provided expression is not reduced.
Expand All @@ -1849,7 +1849,7 @@ This function may return arbitrary results if the provided expression is not red
```jldoctest
julia> R = root_system(:B, 3);

julia> demazure_character(R, [0, 1, 0], [3, 2, 1])
julia> demazure_character(R, [0, 1, 0], [1, 2, 3])
Dict{WeightLatticeElem, Int64} with 4 entries:
w_1 + w_2 - 2*w_3 => 1
w_1 => 1
Expand Down Expand Up @@ -1884,7 +1884,7 @@ function demazure_character(
@req root_system(w) === R "parent root system mismatch"
@req is_dominant(w) "not a dominant weight"
char = Dict{WeightLatticeElem,T}(w => T(1))
for i in Iterators.reverse(reduced_expression)
for i in reduced_expression
char = demazure_operator(simple_root(root_system(w), Int(i)), char)
end
return char
Expand Down
6 changes: 2 additions & 4 deletions experimental/LieAlgebras/src/WeightLattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ end
conjugate_dominant_weight_with_elem(w::WeightLatticeElem) -> Tuple{WeightLatticeElem, WeylGroupElem}

Returns the unique dominant weight `dom` conjugate to `w` and a Weyl group element `x`
such that `x * w == dom`.

If one wants a group element that takes `w` to`dom` using a right action, one can use `inv(x)`.
such that `w * x == dom`.
"""
function conjugate_dominant_weight_with_elem(w::WeightLatticeElem)
return conjugate_dominant_weight_with_elem!(deepcopy(w))
Expand All @@ -362,7 +360,7 @@ function conjugate_dominant_weight_with_elem!(w::WeightLatticeElem)

# reversing word means it is in short revlex normal form
# and it is the element taking original w to new w
return w, weyl_group(root_system(w))(reverse!(word); normalize=false)
return w, weyl_group(root_system(w))(word; normalize=true) # TODO: is normalize=true necessary?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

end

function dot(w1::WeightLatticeElem, w2::WeightLatticeElem)
Expand Down
26 changes: 7 additions & 19 deletions experimental/LieAlgebras/src/WeylGroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,8 @@
return p
end

@doc raw"""
*(x::WeylGroupElem, r::RootSpaceElem) -> RootSpaceElem
*(x::WeylGroupElem, w::WeightLatticeElem) -> WeightLatticeElem

Return the result of acting with `x` **from the left** on `r` or `w`.

See also: [`*(::Union{RootSpaceElem,WeightLatticeElem}, ::WeylGroupElem)`](@ref).
"""
function Base.:*(x::WeylGroupElem, rw::Union{RootSpaceElem,WeightLatticeElem})
@req root_system(parent(x)) === root_system(rw) "Incompatible root systems"

rw2 = deepcopy(rw)
for s in Iterators.reverse(word(x))
reflect!(rw2, Int(s))
end

return rw2
function Base.:*(::WeylGroupElem, ::Union{RootSpaceElem,WeightLatticeElem})
error("OSCAR only supports the right action of Weyl groups")

Check warning on line 252 in experimental/LieAlgebras/src/WeylGroup.jl

View check run for this annotation

Codecov / codecov/patch

experimental/LieAlgebras/src/WeylGroup.jl#L251-L252

Added lines #L251 - L252 were not covered by tests
end

@doc raw"""
Expand Down Expand Up @@ -697,7 +682,7 @@

# Iterates over all weights in the Weyl group orbit of the dominant weight `weight`,
# or analogously over all elements in the quotient W/W_P
# The iterator returns a tuple (wt, x), such that x*wt == iter.weight;
# The iterator returns a tuple (wt, x), such that wt*x == iter.weight;
# this choice is made to align with conjugate_dominant_weight_with_elem

function Base.IteratorSize(::Type{WeylIteratorNoCopy})
Expand All @@ -719,7 +704,10 @@
if isnothing(state)
return nothing
end
return state, state
# return state, state
# TODO: change internals of iterator to return (wt, x) with wt*x == iter.weight instead of the hack below
wt, x = state
return (wt, inv(x)), state
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

end

function _iterate_nocopy(state::WeylIteratorNoCopyState)
Expand Down
24 changes: 12 additions & 12 deletions experimental/LieAlgebras/test/LieAlgebraModule-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1235,45 +1235,45 @@
#x = s[1]*s[2]
char = demazure_character(R, fundamental_weight(R, 1), W([1, 2]))
@test char == Dict(
WeightLatticeElem(R, [0, -1]) => 1,
WeightLatticeElem(R, [-1, 1]) => 1,
WeightLatticeElem(R, [1, 0]) => 1,
)

char = demazure_character(R, fundamental_weight(R, 2), W([1, 2]))
@test char == Dict(
WeightLatticeElem(R, [-1, 0]) => 1,
WeightLatticeElem(R, [1, -1]) => 1,
WeightLatticeElem(R, [0, 1]) => 1,
)

char = demazure_character(R, weyl_vector(R), W([1, 2]))
@test char == Dict(
WeightLatticeElem(R, [-1, 2]) => 1,
WeightLatticeElem(R, [-2, 1]) => 1,
WeightLatticeElem(R, [2, -1]) => 1,
WeightLatticeElem(R, [1, -2]) => 1,
WeightLatticeElem(R, [-1, 2]) => 1,
WeightLatticeElem(R, [0, 0]) => 1,
WeightLatticeElem(R, [1, 1]) => 1,
)

#x = s[2]*s[1]
char = demazure_character(R, fundamental_weight(R, 1), W([2, 1]))
@test char == Dict(
WeightLatticeElem(R, [0, -1]) => 1,
WeightLatticeElem(R, [-1, 1]) => 1,
WeightLatticeElem(R, [1, 0]) => 1,
)

char = demazure_character(R, fundamental_weight(R, 2), W([2, 1]))
@test char == Dict(
WeightLatticeElem(R, [-1, 0]) => 1,
WeightLatticeElem(R, [1, -1]) => 1,
WeightLatticeElem(R, [0, 1]) => 1,
)

char = demazure_character(R, weyl_vector(R), W([2, 1]))
@test char == Dict(
WeightLatticeElem(R, [2, -1]) => 1,
WeightLatticeElem(R, [1, -2]) => 1,
WeightLatticeElem(R, [-1, 2]) => 1,
WeightLatticeElem(R, [-2, 1]) => 1,
WeightLatticeElem(R, [2, -1]) => 1,
WeightLatticeElem(R, [0, 0]) => 1,
WeightLatticeElem(R, [1, 1]) => 1,
)
Expand Down Expand Up @@ -1435,8 +1435,8 @@
WeightLatticeElem(R, [1, 2, -1]) => 1,
)

#x=s[3]*s[2]*s[1]
char = demazure_character(R, fundamental_weight(R, 1), W([3, 2, 1]))
#x=s[1]*s[2]*s[3]
char = demazure_character(R, fundamental_weight(R, 1), W([1, 2, 3]))
@test char == Dict(
WeightLatticeElem(R, [0, 0, 0]) => 1,
WeightLatticeElem(R, [0, 1, -2]) => 1,
Expand All @@ -1445,21 +1445,21 @@
WeightLatticeElem(R, [0, -1, 2]) => 1,
)

char = demazure_character(R, fundamental_weight(R, 2), W([3, 2, 1]))
char = demazure_character(R, fundamental_weight(R, 2), W([1, 2, 3]))
@test char == Dict(
WeightLatticeElem(R, [0, 1, 0]) => 1,
WeightLatticeElem(R, [1, -1, 2]) => 1,
WeightLatticeElem(R, [1, 0, 0]) => 1,
WeightLatticeElem(R, [1, 1, -2]) => 1,
)

char = demazure_character(R, fundamental_weight(R, 3), W([3, 2, 1]))
char = demazure_character(R, fundamental_weight(R, 3), W([1, 2, 3]))
@test char == Dict(
WeightLatticeElem(R, [0, 1, -1]) => 1,
WeightLatticeElem(R, [0, 0, 1]) => 1,
)

char = demazure_character(R, weyl_vector(R), W([3, 2, 1]))
char = demazure_character(R, weyl_vector(R), W([1, 2, 3]))
@test char == Dict(
WeightLatticeElem(R, [2, 0, 1]) => 1,
WeightLatticeElem(R, [1, 2, -3]) => 1,
Expand Down Expand Up @@ -1602,7 +1602,7 @@
L = lie_algebra(QQ, R)
w_int = [0, 1, 0]
w_weight = WeightLatticeElem(R, w_int)
x = W([3, 2, 1])
x = W([1, 2, 3])
reduced_expression = word(x)
result = Dict(
WeightLatticeElem(R, [0, 1, 0]) => 1,
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/test/RootSystem-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
n_roots(R) >= 1 && for _ in 1:10
r = root(R, rand(1:n_roots(R)))
w = rand(W)
@test is_root(w * r)
@test is_root(r * w)
end

@test length(simple_coroots(R)) == n_simple_roots(R)
Expand Down
8 changes: 6 additions & 2 deletions experimental/LieAlgebras/test/WeightLattice-test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
@testset "LieAlgebras.WeightLattice" begin
function is_in_normal_form(x::WeylGroupElem)
return word(parent(x)(word(x))) == word(x)
end

@testset "WeightLatticeElem" begin
R = root_system(:A, 2)
w = WeightLatticeElem(R, [2, 2])
Expand All @@ -19,8 +23,8 @@
wt = WeightLatticeElem(R, vec)
d, x = conjugate_dominant_weight_with_elem(wt)
@test is_dominant(d)
@test x * wt == d
@test wt * inv(x) == d
@test is_in_normal_form(x)
@test wt * x == d
end
end
end
Loading
Loading