1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 14:35:28 +01:00
Groups.jl/test/fp_groups.jl

60 lines
1.4 KiB
Julia
Raw Normal View History

2021-05-24 14:46:54 +02:00
@testset "FPGroups" begin
A = Alphabet([:a, :A, :b, :B, :c, :C], [2,1,4,3,6,5])
@test FreeGroup(A) isa FreeGroup
@test sprint(show, FreeGroup(A)) == "free group on 3 generators"
F = FreeGroup([:a, :b, :c], A)
@test sprint(show, F) == "free group on 3 generators"
2021-05-24 14:46:54 +02:00
a,b,c = gens(F)
@test c*b*a isa FPGroupElement
2021-05-24 14:46:54 +02:00
# quotient of F:
G = FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
2021-05-24 14:46:54 +02:00
@test G isa FPGroup
2021-06-21 17:53:29 +02:00
@test sprint(show, G) == "⟨a, b, c | a*b => b*a, a*c => c*a, b*c => c*b⟩"
@test rand(G) isa FPGroupElement
2021-05-24 14:46:54 +02:00
f = a*c*b
@test word(f) isa Word{UInt8}
2021-05-24 14:46:54 +02:00
aG,bG,cG = gens(G)
@test aG isa FPGroupElement
2021-05-24 14:46:54 +02:00
@test_throws AssertionError aG == a
@test word(aG) == word(a)
2021-05-24 14:46:54 +02:00
g = aG*cG*bG
@test_throws AssertionError f == g
@test word(f) == word(g)
@test word(g) == [1, 5, 3]
Groups.normalform!(g)
@test word(g) == [1, 3, 5]
2021-05-24 14:46:54 +02:00
2021-06-21 17:53:29 +02:00
let g = aG*cG*bG
# test that we normalize g before printing
@test sprint(show, g) == "a*b*c"
end
2021-05-24 14:46:54 +02:00
# quotient of G
H = FPGroup(G, [aG^2=>cG, bG*cG=>aG], maxrules=200)
2021-05-24 14:46:54 +02:00
h = H(word(g))
2021-05-24 14:46:54 +02:00
@test h isa FPGroupElement
2021-05-24 14:46:54 +02:00
@test_throws AssertionError h == g
@test_throws AssertionError h*g
Groups.normalform!(h)
2021-05-24 14:46:54 +02:00
@test h == H([5])
@testset "GroupsCore conformance: H" begin
test_Group_interface(H)
test_GroupElement_interface(rand(H, 2)...)
end
2021-05-24 14:46:54 +02:00
end