1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-26 02:20:30 +01:00

more tests for AutGroup

This commit is contained in:
kalmarek 2020-04-20 02:41:24 +02:00
parent a6aabf4541
commit cdbd483e9e
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
3 changed files with 33 additions and 25 deletions

View File

@ -262,7 +262,7 @@ end
function show(io::IO, G::AutGroup) function show(io::IO, G::AutGroup)
print(io, "Automorphism Group of $(G.objectGroup)\n") print(io, "Automorphism Group of $(G.objectGroup)\n")
print(io, "Generated by $(join(G.gens, ","))") print(io, "Generated by $(gens(G))")
end end
############################################################################### ###############################################################################

View File

@ -31,11 +31,6 @@ function DirectPower(G::DirectPowerGroup{N}, H::Group) where N
return DirectPowerGroup(G.group, N+1) return DirectPowerGroup(G.group, N+1)
end end
function DirectPower(R::AbstractAlgebra.Ring, n::Int)
@warn "Creating DirectPower of the multilplicative group!"
return DirectPowerGroup(MultiplicativeGroup(R), n)
end
struct DirectPowerGroupElem{N, T<:GroupElem} <: GroupElem struct DirectPowerGroupElem{N, T<:GroupElem} <: GroupElem
elts::NTuple{N,T} elts::NTuple{N,T}
end end
@ -188,7 +183,6 @@ end
############################################################################### ###############################################################################
order(G::DirectPowerGroup{N}) where N = order(G.group)^N order(G::DirectPowerGroup{N}) where N = order(G.group)^N
Base.length(G::DirectPowerGroup) = order(G)
function iterate(G::DirectPowerGroup{N}) where N function iterate(G::DirectPowerGroup{N}) where N
elts = collect(G.group) elts = collect(G.group)
@ -212,3 +206,4 @@ function iterate(G::DirectPowerGroup{N}, state) where N
end end
eltype(::Type{DirectPowerGroup{N, G}}) where {N, G} = DirectPowerGroupElem{N, elem_type(G)} eltype(::Type{DirectPowerGroup{N, G}}) where {N, G} = DirectPowerGroupElem{N, elem_type(G)}
Base.length(G::DirectPowerGroup) = order(G)

View File

@ -6,13 +6,17 @@
@test_throws MethodError Groups.AutSymbol(:a) @test_throws MethodError Groups.AutSymbol(:a)
@test_throws MethodError Groups.AutSymbol(:a, 1) @test_throws MethodError Groups.AutSymbol(:a, 1)
f = Groups.AutSymbol(:a, 1, Groups.FlipAut(2)) f = Groups.AutSymbol(:a, 1, Groups.FlipAut(2))
@test isa(f, Groups.GSymbol) @test f isa Groups.GSymbol
@test isa(f, Groups.AutSymbol) @test f isa Groups.AutSymbol
@test isa(Groups.AutSymbol(perm"(4)"), Groups.AutSymbol) @test Groups.AutSymbol(perm"(4)") isa Groups.AutSymbol
@test isa(Groups.AutSymbol(perm"(1,2,3,4)"), Groups.AutSymbol) @test Groups.AutSymbol(perm"(1,2,3,4)") isa Groups.AutSymbol
@test isa(Groups.transvection_R(1,2), Groups.AutSymbol) @test Groups.transvection_R(1,2) isa Groups.AutSymbol
@test isa(Groups.transvection_R(3,4), Groups.AutSymbol) @test Groups.transvection_R(3,4) isa Groups.AutSymbol
@test isa(Groups.flip(3), Groups.AutSymbol) @test Groups.flip(3) isa Groups.AutSymbol
@test Groups.id_autsymbol() isa Groups.AutSymbol
@test inv(Groups.id_autsymbol()) isa Groups.AutSymbol
@test inv(Groups.id_autsymbol()) == Groups.id_autsymbol()
end end
a,b,c,d = gens(FreeGroup(4)) a,b,c,d = gens(FreeGroup(4))
@ -88,35 +92,44 @@
@test isa(Automorphism{3}(f), Automorphism) @test isa(Automorphism{3}(f), Automorphism)
@test isa(AutGroup(FreeGroup(3)), AbstractAlgebra.Group) @test isa(AutGroup(FreeGroup(3)), AbstractAlgebra.Group)
@test isa(AutGroup(FreeGroup(1)), Groups.AbstractFPGroup) @test isa(AutGroup(FreeGroup(1)), Groups.AbstractFPGroup)
A = AutGroup(FreeGroup(1)) A = AutGroup(FreeGroup(1))
@test isa(Groups.gens(A), Vector{Automorphism{1}}) @test Groups.gens(A) isa Vector{Automorphism{1}}
@test length(Groups.gens(A)) == 1 @test length(Groups.gens(A)) == 1
@test length(Groups.gens(Aut(FreeGroup(1)))) == 1
@test Groups.gens(A) == [A(Groups.flip(1))]
A = AutGroup(FreeGroup(1), special=true) A = AutGroup(FreeGroup(1), special=true)
@test length(Groups.gens(A)) == 0 @test isempty(Groups.gens(A))
@test Groups.gens(SAut(FreeGroup(1))) == Automorphism{1}[]
A = AutGroup(FreeGroup(2)) A = AutGroup(FreeGroup(2))
@test length(Groups.gens(A)) == 7 @test length(Groups.gens(A)) == 7
Agens = Groups.gens(A) Agens = Groups.gens(A)
@test A(first(Agens)) isa Automorphism
@test isa(A(Groups.transvection_R(1,2)), Automorphism) @test A(Groups.transvection_R(1,2)) isa Automorphism
@test A(Groups.transvection_R(1,2)) in Agens @test A(Groups.transvection_R(1,2)) in Agens
@test isa(A(Groups.transvection_R(2,1)), Automorphism) @test A(Groups.transvection_R(2,1)) isa Automorphism
@test A(Groups.transvection_R(2,1)) in Agens @test A(Groups.transvection_R(2,1)) in Agens
@test isa(A(Groups.transvection_R(1,2)), Automorphism) @test A(Groups.transvection_R(1,2)) isa Automorphism
@test A(Groups.transvection_R(1,2)) in Agens @test A(Groups.transvection_R(1,2)) in Agens
@test isa(A(Groups.transvection_R(2,1)), Automorphism) @test A(Groups.transvection_R(2,1)) isa Automorphism
@test A(Groups.transvection_R(2,1)) in Agens @test A(Groups.transvection_R(2,1)) in Agens
@test isa(A(Groups.flip(1)), Automorphism) @test A(Groups.flip(1)) isa Automorphism
@test A(Groups.flip(1)) in Agens @test A(Groups.flip(1)) in Agens
@test isa(A(Groups.flip(2)), Automorphism) @test A(Groups.flip(2)) isa Automorphism
@test A(Groups.flip(2)) in Agens @test A(Groups.flip(2)) in Agens
@test isa(A(Groups.AutSymbol(perm"(1,2)")), Automorphism) @test A(Groups.AutSymbol(perm"(1,2)")) isa Automorphism
@test A(Groups.AutSymbol(perm"(1,2)")) in Agens @test A(Groups.AutSymbol(perm"(1,2)")) in Agens
@test A(Groups.id_autsymbol()) isa Automorphism
end end
A = AutGroup(FreeGroup(4)) A = AutGroup(FreeGroup(4))
@ -144,8 +157,8 @@
@test ^2 == one(A) @test ^2 == one(A)
@test !isone() @test !isone()
a = A(Groups.transvection_L(1,2))*Groups.flip(2) a = A(Groups.λ(1,2))*Groups.ε(2)
b = Groups.flip(2)*A(inv(Groups.transvection_L(1,2))) b = Groups.ε(2)*A(inv(Groups.λ(1,2)))
@test a*b == b*a @test a*b == b*a
@test a^3 * b^3 == one(A) @test a^3 * b^3 == one(A)
g,h = Groups.gens(A)[[1,8]] # (g, h) = (ϱ₁₂, ϱ₃₂) g,h = Groups.gens(A)[[1,8]] # (g, h) = (ϱ₁₂, ϱ₃₂)