2017-05-15 10:12:46 +02:00
|
|
|
|
@testset "Automorphisms" begin
|
|
|
|
|
using Nemo
|
2018-03-22 17:24:23 +01:00
|
|
|
|
G = PermutationGroup(Int8(4))
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
|
|
|
|
@testset "AutSymbol" begin
|
|
|
|
|
@test_throws MethodError Groups.AutSymbol("a")
|
|
|
|
|
@test_throws MethodError Groups.AutSymbol("a", 1)
|
2017-10-27 16:20:06 +02:00
|
|
|
|
f = Groups.AutSymbol("a", 1, Groups.FlipAut(2))
|
2017-05-15 10:12:46 +02:00
|
|
|
|
@test isa(f, Groups.GSymbol)
|
|
|
|
|
@test isa(f, Groups.AutSymbol)
|
2018-04-09 13:01:21 +02:00
|
|
|
|
@test isa(Groups.perm_autsymbol(Int8.([1,2,3,4])), Groups.AutSymbol)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
@test isa(Groups.rmul_autsymbol(1,2), Groups.AutSymbol)
|
|
|
|
|
@test isa(Groups.lmul_autsymbol(3,4), Groups.AutSymbol)
|
|
|
|
|
@test isa(Groups.flip_autsymbol(3), Groups.AutSymbol)
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-05 16:26:35 +02:00
|
|
|
|
a,b,c,d = Nemo.gens(FreeGroup(4))
|
2018-03-22 17:27:31 +01:00
|
|
|
|
D = NTuple{4,FreeGroupElem}([a,b,c,d])
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
|
|
|
|
@testset "flip_autsymbol correctness" begin
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test Groups.flip_autsymbol(1)(deepcopy(D)) == (a^-1, b,c,d)
|
|
|
|
|
@test Groups.flip_autsymbol(2)(deepcopy(D)) == (a, b^-1,c,d)
|
|
|
|
|
@test Groups.flip_autsymbol(3)(deepcopy(D)) == (a, b,c^-1,d)
|
|
|
|
|
@test Groups.flip_autsymbol(4)(deepcopy(D)) == (a, b,c,d^-1)
|
|
|
|
|
@test inv(Groups.flip_autsymbol(1))(deepcopy(D)) == (a^-1, b,c,d)
|
|
|
|
|
@test inv(Groups.flip_autsymbol(2))(deepcopy(D)) == (a, b^-1,c,d)
|
|
|
|
|
@test inv(Groups.flip_autsymbol(3))(deepcopy(D)) == (a, b,c^-1,d)
|
|
|
|
|
@test inv(Groups.flip_autsymbol(4))(deepcopy(D)) == (a, b,c,d^-1)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@testset "perm_autsymbol correctness" begin
|
2018-03-22 17:24:23 +01:00
|
|
|
|
σ = Groups.perm_autsymbol([1,2,3,4])
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test σ(deepcopy(D)) == deepcopy(D)
|
|
|
|
|
@test inv(σ)(deepcopy(D)) == deepcopy(D)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
2018-03-22 17:24:23 +01:00
|
|
|
|
σ = Groups.perm_autsymbol([2,3,4,1])
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test σ(deepcopy(D)) == (b, c, d, a)
|
|
|
|
|
@test inv(σ)(deepcopy(D)) == (d, a, b, c)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
2018-03-22 17:24:23 +01:00
|
|
|
|
σ = Groups.perm_autsymbol([2,1,4,3])
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test σ(deepcopy(D)) == (b, a, d, c)
|
|
|
|
|
@test inv(σ)(deepcopy(D)) == (b, a, d, c)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
2018-03-22 17:24:23 +01:00
|
|
|
|
σ = Groups.perm_autsymbol([2,3,1,4])
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test σ(deepcopy(D)) == (b, c, a, d)
|
|
|
|
|
@test inv(σ)(deepcopy(D)) == (c, a, b, d)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@testset "rmul/lmul_autsymbol correctness" begin
|
|
|
|
|
i,j = 1,2
|
|
|
|
|
r = Groups.rmul_autsymbol(i,j)
|
|
|
|
|
l = Groups.lmul_autsymbol(i,j)
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test r(deepcopy(D)) == (a*b, b, c, d)
|
|
|
|
|
@test inv(r)(deepcopy(D)) == (a*b^-1,b, c, d)
|
|
|
|
|
@test l(deepcopy(D)) == (b*a, b, c, d)
|
|
|
|
|
@test inv(l)(deepcopy(D)) == (b^-1*a,b, c, d)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
|
|
|
|
i,j = 3,1
|
|
|
|
|
r = Groups.rmul_autsymbol(i,j)
|
|
|
|
|
l = Groups.lmul_autsymbol(i,j)
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test r(deepcopy(D)) == (a, b, c*a, d)
|
|
|
|
|
@test inv(r)(deepcopy(D)) == (a, b, c*a^-1,d)
|
|
|
|
|
@test l(deepcopy(D)) == (a, b, a*c, d)
|
|
|
|
|
@test inv(l)(deepcopy(D)) == (a, b, a^-1*c,d)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
|
|
|
|
i,j = 4,3
|
|
|
|
|
r = Groups.rmul_autsymbol(i,j)
|
|
|
|
|
l = Groups.lmul_autsymbol(i,j)
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test r(deepcopy(D)) == (a, b, c, d*c)
|
|
|
|
|
@test inv(r)(deepcopy(D)) == (a, b, c, d*c^-1)
|
|
|
|
|
@test l(deepcopy(D)) == (a, b, c, c*d)
|
|
|
|
|
@test inv(l)(deepcopy(D)) == (a, b, c, c^-1*d)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i,j = 2,4
|
|
|
|
|
r = Groups.rmul_autsymbol(i,j)
|
|
|
|
|
l = Groups.lmul_autsymbol(i,j)
|
2018-03-22 17:27:31 +01:00
|
|
|
|
@test r(deepcopy(D)) == (a, b*d, c, d)
|
|
|
|
|
@test inv(r)(deepcopy(D)) == (a, b*d^-1,c, d)
|
|
|
|
|
@test l(deepcopy(D)) == (a, d*b, c, d)
|
|
|
|
|
@test inv(l)(deepcopy(D)) == (a, d^-1*b,c, d)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
end
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@testset "AutGroup/Automorphism constructors" begin
|
2017-10-27 16:20:06 +02:00
|
|
|
|
f = Groups.AutSymbol("a", 1, Groups.FlipAut(1))
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(Automorphism{3}(f), Groups.GWord)
|
|
|
|
|
@test isa(Automorphism{3}(f), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test isa(AutGroup(FreeGroup(3)), Nemo.Group)
|
2017-07-06 09:13:36 +02:00
|
|
|
|
@test isa(AutGroup(FreeGroup(1)), Groups.AbstractFPGroup)
|
2017-05-15 10:12:46 +02:00
|
|
|
|
A = AutGroup(FreeGroup(1))
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(Nemo.gens(A), Vector{Automorphism{1}})
|
2017-07-05 16:26:35 +02:00
|
|
|
|
@test length(Nemo.gens(A)) == 1
|
2017-05-15 17:30:18 +02:00
|
|
|
|
A = AutGroup(FreeGroup(1), special=true)
|
2017-07-05 16:26:35 +02:00
|
|
|
|
@test length(Nemo.gens(A)) == 0
|
2017-05-15 17:30:18 +02:00
|
|
|
|
A = AutGroup(FreeGroup(2))
|
2017-07-05 16:26:35 +02:00
|
|
|
|
@test length(Nemo.gens(A)) == 7
|
|
|
|
|
gens = Nemo.gens(A)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.rmul_autsymbol(1,2)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.rmul_autsymbol(1,2)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.rmul_autsymbol(2,1)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.rmul_autsymbol(2,1)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.lmul_autsymbol(1,2)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.lmul_autsymbol(1,2)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.lmul_autsymbol(2,1)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.lmul_autsymbol(2,1)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.flip_autsymbol(1)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.flip_autsymbol(1)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.flip_autsymbol(2)), Automorphism)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test A(Groups.flip_autsymbol(2)) in gens
|
|
|
|
|
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(A(Groups.perm_autsymbol([2,1])), Automorphism)
|
2018-03-22 17:24:23 +01:00
|
|
|
|
@test A(Groups.perm_autsymbol([2,1])) in gens
|
2017-05-15 17:30:18 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
A = AutGroup(FreeGroup(4))
|
|
|
|
|
|
|
|
|
|
@testset "eltary functions" begin
|
|
|
|
|
|
2018-03-22 17:24:23 +01:00
|
|
|
|
f = Groups.perm_autsymbol([2,3,4,1])
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test (Groups.change_pow(f, 2)).pow == 1
|
|
|
|
|
@test (Groups.change_pow(f, -2)).pow == 1
|
|
|
|
|
@test (inv(f)).pow == 1
|
|
|
|
|
|
2018-03-22 17:24:23 +01:00
|
|
|
|
f = Groups.perm_autsymbol([2,1,4,3])
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test isa(inv(f), Groups.AutSymbol)
|
|
|
|
|
|
|
|
|
|
@test_throws DomainError f^-1
|
|
|
|
|
@test_throws MethodError f*f
|
|
|
|
|
|
|
|
|
|
@test A(f)^-1 == A(inv(f))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@testset "reductions/arithmetic" begin
|
2018-03-22 17:24:23 +01:00
|
|
|
|
f = Groups.perm_autsymbol([2,3,4,1])
|
2017-05-15 17:30:18 +02:00
|
|
|
|
|
|
|
|
|
f² = Groups.r_multiply(A(f), [f], reduced=false)
|
2018-04-03 15:36:32 +02:00
|
|
|
|
@test Groups.simplifyperms!(f²) == false
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test f²^2 == A()
|
|
|
|
|
|
|
|
|
|
a = A(Groups.rmul_autsymbol(1,2))*Groups.flip_autsymbol(2)
|
|
|
|
|
b = Groups.flip_autsymbol(2)*A(inv(Groups.rmul_autsymbol(1,2)))
|
|
|
|
|
@test a*b == b*a
|
|
|
|
|
@test a^3 * b^3 == A()
|
2018-03-27 21:49:22 +02:00
|
|
|
|
g,h = Nemo.gens(A)[[1,8]] # (g, h) = (ϱ₁₂, ϱ₃₂)
|
2018-03-22 17:27:31 +01:00
|
|
|
|
|
|
|
|
|
@test Groups.domain(A) == NTuple{4, FreeGroupElem}(gens(A.objectGroup))
|
|
|
|
|
|
|
|
|
|
@test (g*h)(Groups.domain(A)) == (h*g)(Groups.domain(A))
|
2017-10-27 16:16:43 +02:00
|
|
|
|
@test (g*h).savedhash != (h*g).savedhash
|
|
|
|
|
a = g*h
|
|
|
|
|
b = h*g
|
|
|
|
|
@test hash(a) == hash(b)
|
|
|
|
|
@test a.savedhash == b.savedhash
|
|
|
|
|
@test length(unique([a,b])) == 1
|
|
|
|
|
@test length(unique([g*h, h*g])) == 1
|
2018-03-22 17:28:07 +01:00
|
|
|
|
|
|
|
|
|
# Not so simple arithmetic: applying starting on the left:
|
|
|
|
|
# ϱ₁₂*ϱ₂₁⁻¹*λ₁₂*ε₂ == σ₂₁₃₄
|
|
|
|
|
|
|
|
|
|
g = A(Groups.rmul_autsymbol(1,2))
|
|
|
|
|
x1, x2, x3, x4 = Groups.domain(A)
|
|
|
|
|
@test g(Groups.domain(A)) == (x1*x2, x2, x3, x4)
|
|
|
|
|
g = g*inv(A(Groups.rmul_autsymbol(2,1)))
|
|
|
|
|
@test g(Groups.domain(A)) == (x1*x2, x1^-1, x3, x4)
|
|
|
|
|
g = g*A(Groups.lmul_autsymbol(1,2))
|
|
|
|
|
@test g(Groups.domain(A)) == (x2, x1^-1, x3, x4)
|
|
|
|
|
g = g*A(Groups.flip_autsymbol(2))
|
|
|
|
|
@test g(Groups.domain(A)) == (x2, x1, x3, x4)
|
|
|
|
|
|
|
|
|
|
@test g(Groups.domain(A)) == A(Groups.perm_autsymbol([2,1,3,4]))(Groups.domain(A))
|
|
|
|
|
|
|
|
|
|
@test g == A(Groups.perm_autsymbol([2,1,3,4]))
|
|
|
|
|
|
2018-03-27 20:15:28 +02:00
|
|
|
|
g_im = g(Groups.domain(A))
|
|
|
|
|
@test length(g_im[1]) == 5
|
|
|
|
|
@test length(g_im[2]) == 3
|
|
|
|
|
@test length(g_im[3]) == 1
|
|
|
|
|
@test length(g_im[4]) == 1
|
|
|
|
|
@test length.(Groups.reduce!.(g_im)) == (1,1,1,1)
|
|
|
|
|
|
2017-05-15 17:30:18 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@testset "specific Aut(F4) tests" begin
|
|
|
|
|
N = 4
|
|
|
|
|
G = AutGroup(FreeGroup(N))
|
|
|
|
|
S = G.gens
|
|
|
|
|
@test isa(S, Vector{Groups.AutSymbol})
|
|
|
|
|
S = [G(s) for s in unique(S)]
|
2018-03-27 21:49:22 +02:00
|
|
|
|
@test isa(S, Vector{Automorphism{N}})
|
2017-07-05 16:26:35 +02:00
|
|
|
|
@test S == Nemo.gens(G)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
@test length(S) == 51
|
|
|
|
|
S_inv = [S..., [inv(s) for s in S]...]
|
|
|
|
|
@test length(unique(S_inv)) == 75
|
|
|
|
|
|
2017-10-24 15:28:02 +02:00
|
|
|
|
G = AutGroup(FreeGroup(N), special=true)
|
2017-07-05 16:26:35 +02:00
|
|
|
|
S = Nemo.gens(G)
|
2017-05-15 17:30:18 +02:00
|
|
|
|
S_inv = [G(), S..., [inv(s) for s in S]...]
|
|
|
|
|
S_inv = unique(S_inv)
|
|
|
|
|
B_2 = [i*j for (i,j) in Base.product(S_inv, S_inv)]
|
|
|
|
|
@test length(B_2) == 2401
|
|
|
|
|
@test length(unique(B_2)) == 1777
|
2017-05-15 10:12:46 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|