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

fix: dealias inv(id) from id

This commit is contained in:
kalmarek 2020-04-20 03:25:25 +02:00
parent a5fd4421d5
commit 512394e69b
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
4 changed files with 12 additions and 4 deletions

View File

@ -91,7 +91,7 @@ function change_pow(s::AutSymbol, n::Integer)
elseif symbol isa LTransvect
return transvection_L(symbol.i, symbol.j, n)
elseif symbol isa Identity
return s
return id_autsymbol()
else
throw(DomainError("Unknown type of AutSymbol: $s"))
end

View File

@ -1,5 +1,5 @@
function Base.inv(W::T) where T<:GWord
length(W) == 0 && return W
length(W) == 0 && return one(W)
G = parent(W)
w = T([inv(s) for s in Iterators.reverse(syllables(W))])
return setparent!(w, G)

View File

@ -16,7 +16,8 @@
@test Groups.id_autsymbol() isa Groups.AutSymbol
@test inv(Groups.id_autsymbol()) isa Groups.AutSymbol
@test inv(Groups.id_autsymbol()) == Groups.id_autsymbol()
x = Groups.id_autsymbol()
@test inv(x) == Groups.id_autsymbol()
end
a,b,c,d = gens(FreeGroup(4))

View File

@ -109,6 +109,13 @@ end
tt = deepcopy(t)
append!(tt, s, inv(t))
@test string(tt) == "t*s*t^-1"
o = one(t)
o_inv = inv(o)
@test o == o_inv
@test o !== o_inv
Groups.rmul!(o, t)
@test o != o_inv
end
@testset "reductions" begin