diff --git a/src/FPGroups.jl b/src/FPGroups.jl index 65e1bbd..642c40b 100644 --- a/src/FPGroups.jl +++ b/src/FPGroups.jl @@ -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")