1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-08-08 07:53:53 +02:00

hash, isone, change_pow, length for FPSymbol

This commit is contained in:
kalmar 2017-05-11 18:19:59 +02:00
parent 31cb855c9c
commit 6c312cfef3

View File

@ -54,6 +54,14 @@ end
(G::FPGroup)(s::FPSymbol) = G(FPGroupElem(s))
hash(s::FPSymbol, h::UInt) = hash(s.str, hash(s.pow, hash(FPSymbol, h)))
isone(s::FPSymbol) = s.pow == 0
change_pow(s::FPSymbol, n::Int) = FPSymbol(s.str, n)
length(s::FPSymbol) = abs(s.pow)
function show(io::IO, G::FPGroup)
print(io, "Finitely presented group on $(length(G.gens)) gens and $(length(G.rels)) relations:\n")
print(io, "gens:\t", join([g.gen for g in G.gens], ","),"\n")