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

add permutation action on FreeAssAlgElems #2792

Merged
merged 1 commit into from
Sep 15, 2023
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
16 changes: 15 additions & 1 deletion src/Groups/action.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
"""
on_indeterminates(f::GAP.GapObj, p::PermGroupElem)
on_indeterminates(f::MPolyRingElem, p::PermGroupElem)
on_indeterminates(f::FreeAssAlgElem, p::PermGroupElem)
on_indeterminates(f::MPolyIdeal, p::PermGroupElem)
on_indeterminates(f::GAP.GapObj, p::MatrixGroupElem)
on_indeterminates(f::MPolyRingElem{T}, p::MatrixGroupElem{T, S}) where T where S
Expand All @@ -294,7 +295,7 @@
if `p` is a `MatrixGroupElem` then it acts via evaluating `f` at the
vector obtained by multiplying `p` with the (column) vector of indeterminates.

For `MPolyRingElem` and `MPolyIdeal` objects,
For `MPolyRingElem`, `FreeAssAlgElem`, and `MPolyIdeal` objects,
one can also call `^` instead of `on_indeterminates`.

# Examples
Expand Down Expand Up @@ -348,6 +349,17 @@
return finish(g)
end

function on_indeterminates(f::FreeAssAlgElem{T}, s::PermGroupElem) where T
G = parent(s)
S = parent(f)
@assert ngens(S) == degree(G)

Check warning on line 355 in src/Groups/action.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/action.jl#L352-L355

Added lines #L352 - L355 were not covered by tests

e = exponent_words(f)
c = Vector{T}(collect(coefficients(f)))
es = [on_tuples(x, s) for x in e]
return S(c, es)

Check warning on line 360 in src/Groups/action.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/action.jl#L357-L360

Added lines #L357 - L360 were not covered by tests
end

function on_indeterminates(f::GapObj, p::MatrixGroupElem)
# We assume that we act on the indeterminates with numbers 1, ..., nrows(p).
# (Note that `f` does not know about a polynomial ring to which it belongs.)
Expand Down Expand Up @@ -379,6 +391,8 @@

^(f::MPolyRingElem, p::PermGroupElem) = on_indeterminates(f, p)

^(f::FreeAssAlgElem, p::PermGroupElem) = on_indeterminates(f, p)

Check warning on line 394 in src/Groups/action.jl

View check run for this annotation

Codecov / codecov/patch

src/Groups/action.jl#L394

Added line #L394 was not covered by tests

^(f::MPolyRingElem{T}, p::MatrixGroupElem{T, S}) where T where S = on_indeterminates(f, p)

^(I::MPolyIdeal, p::PermGroupElem) = on_indeterminates(I, p)
Expand Down
15 changes: 15 additions & 0 deletions test/Groups/action.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ end
@test I^gen(g, 1) == on_indeterminates(I, gen(g, 1))
end

@testset "action on elements of free assoc. algebras: permutations" begin
g = symmetric_group(3)
R, vars = free_associative_algebra(QQ, 3);
(x1, x2, x3) = vars
f = x1*x2 + x2*x3

for p in [g(cperm(1:3)), g(cperm(1:2))]
@test f^p == evaluate(f, permuted(vars, p^-1))
end

for x in gens(g), y in gens(g)
@test on_indeterminates(on_indeterminates(f, x), y) == on_indeterminates(f, x*y)
end
end

@testset "action on multivariate polynomials: matrices" begin
g = general_linear_group(3, 5)
R, vars = polynomial_ring(base_ring(g), degree(g))
Expand Down
Loading