From 512394e69b9477a537cfbd157340d218471bbe41 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 20 Apr 2020 03:25:25 +0200 Subject: [PATCH 1/2] fix: dealias inv(id) from id --- src/AutGroup.jl | 2 +- src/arithmetic.jl | 2 +- test/AutGroup-tests.jl | 5 +++-- test/FreeGroup-tests.jl | 7 +++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/AutGroup.jl b/src/AutGroup.jl index dcbb1e1..fa05877 100644 --- a/src/AutGroup.jl +++ b/src/AutGroup.jl @@ -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 diff --git a/src/arithmetic.jl b/src/arithmetic.jl index c7e8c21..f84527d 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -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) diff --git a/test/AutGroup-tests.jl b/test/AutGroup-tests.jl index 50621e2..0b9c658 100644 --- a/test/AutGroup-tests.jl +++ b/test/AutGroup-tests.jl @@ -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)) @@ -266,7 +267,7 @@ @test Groups.abelianize(σ^3) == Matrix{Int}(I, N, N) @test Groups.abelianize(σ)^3 == Matrix{Int}(I, N, N) - @test Groups.abelianize(G(Groups.id_autsymbol())) == Matrix{Int}(I, N, N) + @test Groups.abelianize(G(Groups.id_autsymbol())) == Matrix{Int}(I, N, N) function test_homomorphism(S, r) for elts in Iterators.product([[g for g in S] for _ in 1:r]...) diff --git a/test/FreeGroup-tests.jl b/test/FreeGroup-tests.jl index 3a1863f..49f4b82 100644 --- a/test/FreeGroup-tests.jl +++ b/test/FreeGroup-tests.jl @@ -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 From 6a9620cbc6b415b1a7be125a19eabf17c9f4d578 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Tue, 21 Apr 2020 16:45:53 +0200 Subject: [PATCH 2/2] bump version to 0.4.2 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2ff5726..f35039c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Groups" uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557" authors = ["Marek Kaluba "] -version = "0.4.1" +version = "0.4.2" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"