From f74b48b8909a6c3ec7e96151eeef2f1dc195576b Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Fri, 28 May 2021 14:20:17 +0200 Subject: [PATCH] separate SAut(F_n) from AutomorphismGroups --- src/Groups.jl | 5 ++- src/{ => groups}/gersten_relations.jl | 0 src/groups/sautFn.jl | 34 +++++++++++++++++++ .../transvections.jl} | 3 -- src/new_autgroups.jl | 30 +--------------- src/new_types.jl | 5 +++ 6 files changed, 42 insertions(+), 35 deletions(-) rename src/{ => groups}/gersten_relations.jl (100%) create mode 100644 src/groups/sautFn.jl rename src/{new_transvections.jl => groups/transvections.jl} (96%) diff --git a/src/Groups.jl b/src/Groups.jl index d2d477e..596e127 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -28,11 +28,10 @@ import OrderedCollections: OrderedSet include("new_types.jl") include("new_hashing.jl") include("normalform.jl") - -include("new_transvections.jl") -include("gersten_relations.jl") include("new_autgroups.jl") +include("groups/sautFn.jl") + end # module New ############################################################################### diff --git a/src/gersten_relations.jl b/src/groups/gersten_relations.jl similarity index 100% rename from src/gersten_relations.jl rename to src/groups/gersten_relations.jl diff --git a/src/groups/sautFn.jl b/src/groups/sautFn.jl new file mode 100644 index 0000000..17ba331 --- /dev/null +++ b/src/groups/sautFn.jl @@ -0,0 +1,34 @@ +include("transvections.jl") +include("gersten_relations.jl") + +function SpecialAutomorphismGroup(F::FreeGroup; ordering = KnuthBendix.LenLex, kwargs...) + + n = length(KnuthBendix.alphabet(F)) ÷ 2 + A, rels = gersten_relations(n, commutative = false) + S = KnuthBendix.letters(A)[1:2(n^2-n)] + + rws = KnuthBendix.RewritingSystem(rels, ordering(A)) + KnuthBendix.knuthbendix!(rws; kwargs...) + return AutomorphismGroup(F, S, rws, ntuple(i -> gens(F, i), n)) +end + +KnuthBendix.alphabet(G::AutomorphismGroup{<:FreeGroup}) = alphabet(rewriting(G)) + +function relations(G::AutomorphismGroup{<:FreeGroup}) + n = length(KnuthBendix.alphabet(object(G))) ÷ 2 + return last(gersten_relations(n, commutative = false)) +end + +evaluate(f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}) = evaluate!(domain(f), f) + +function evaluate!( + t::NTuple{N,T}, + f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}, + tmp = one(first(t)), +) where {T<:FPGroupElement,N} + A = alphabet(f) + for idx in word(f) + t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))), tmp)::NTuple{N,T} + end + return t +end diff --git a/src/new_transvections.jl b/src/groups/transvections.jl similarity index 96% rename from src/new_transvections.jl rename to src/groups/transvections.jl index d8c8819..06a3737 100644 --- a/src/new_transvections.jl +++ b/src/groups/transvections.jl @@ -1,6 +1,3 @@ -abstract type GSymbol end -Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t) - struct Transvection <: GSymbol id::Symbol ij::UInt8 diff --git a/src/new_autgroups.jl b/src/new_autgroups.jl index d14e539..4122e58 100644 --- a/src/new_autgroups.jl +++ b/src/new_autgroups.jl @@ -12,26 +12,8 @@ struct AutomorphismGroup{G<:Group,T,R,S} <: AbstractFPGroup end object(G::AutomorphismGroup) = G.group - -function SpecialAutomorphismGroup(F::FreeGroup; ordering = KnuthBendix.LenLex, kwargs...) - - n = length(KnuthBendix.alphabet(F)) ÷ 2 - A, rels = gersten_relations(n, commutative = false) - S = KnuthBendix.letters(A)[1:2(n^2-n)] - - rws = KnuthBendix.RewritingSystem(rels, ordering(A)) - KnuthBendix.knuthbendix!(rws; kwargs...) - return AutomorphismGroup(F, S, rws, ntuple(i -> gens(F, i), n)) -end - -KnuthBendix.alphabet(G::AutomorphismGroup{<:FreeGroup}) = alphabet(rewriting(G)) rewriting(G::AutomorphismGroup) = G.rws -function relations(G::AutomorphismGroup) - n = length(KnuthBendix.alphabet(object(G))) ÷ 2 - return last(gersten_relations(n, commutative = false)) -end - function equality_data(f::FPGroupElement{<:AutomorphismGroup}) imf = evaluate(f) # return normalform!.(imf) @@ -107,16 +89,6 @@ Base.show(io::IO, A::AutomorphismGroup) = print(io, "automorphism group of ", ob domain(f::FPGroupElement{<:AutomorphismGroup}) = deepcopy(parent(f).domain) # tuple(gens(object(parent(f)))...) -evaluate(f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}) = evaluate!(domain(f), f) +evaluate(f::FPGroupElement{<:AutomorphismGroup}) = throw("you need to implement `evaluate(::typeof(f))`") -function evaluate!( - t::NTuple{N,T}, - f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}, - tmp = one(first(t)), -) where {T<:FPGroupElement,N} - A = alphabet(f) - for idx in word(f) - t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))), tmp)::NTuple{N,T} - end - return t end diff --git a/src/new_types.jl b/src/new_types.jl index aff0f87..ca34915 100644 --- a/src/new_types.jl +++ b/src/new_types.jl @@ -197,3 +197,8 @@ function Base.show(io::IO, G::FPGroup) join(io, relations(G), ", ") print(io, "⟩") end + +## GSymbol aka letter of alphabet + +abstract type GSymbol end +Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t)