mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 18:15:29 +01:00
tidy a bit alphabet/ordering/rewriting requirements
This commit is contained in:
parent
827969ae84
commit
5752d67009
@ -10,7 +10,7 @@ import OrderedCollections: OrderedSet
|
|||||||
|
|
||||||
import KnuthBendix
|
import KnuthBendix
|
||||||
import KnuthBendix: AbstractWord, Alphabet, Word
|
import KnuthBendix: AbstractWord, Alphabet, Word
|
||||||
import KnuthBendix: alphabet
|
import KnuthBendix: alphabet, ordering
|
||||||
|
|
||||||
export MatrixGroups
|
export MatrixGroups
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
struct SurfaceGroup{T, S, R} <: AbstractFPGroup
|
struct SurfaceGroup{T,S,RW} <: AbstractFPGroup
|
||||||
genus::Int
|
genus::Int
|
||||||
boundaries::Int
|
boundaries::Int
|
||||||
gens::Vector{T}
|
gens::Vector{T}
|
||||||
relations::Vector{<:Pair{S,S}}
|
relations::Vector{<:Pair{S,S}}
|
||||||
rws::R
|
rw::RW
|
||||||
end
|
end
|
||||||
|
|
||||||
include("symplectic_twists.jl")
|
include("symplectic_twists.jl")
|
||||||
@ -69,8 +69,7 @@ function SurfaceGroup(genus::Integer, boundaries::Integer)
|
|||||||
return SurfaceGroup(genus, boundaries, [Al[i] for i in 2:2:length(Al)], rels, rws)
|
return SurfaceGroup(genus, boundaries, [Al[i] for i in 2:2:length(Al)], rels, rws)
|
||||||
end
|
end
|
||||||
|
|
||||||
rewriting(S::SurfaceGroup) = S.rws
|
rewriting(S::SurfaceGroup) = S.rw
|
||||||
KnuthBendix.alphabet(S::SurfaceGroup) = alphabet(rewriting(S))
|
|
||||||
relations(S::SurfaceGroup) = S.relations
|
relations(S::SurfaceGroup) = S.relations
|
||||||
|
|
||||||
function symplectic_twists(π₁Σ::SurfaceGroup)
|
function symplectic_twists(π₁Σ::SurfaceGroup)
|
||||||
|
@ -19,8 +19,6 @@ function SpecialAutomorphismGroup(F::FreeGroup; ordering = KnuthBendix.LenLex, k
|
|||||||
return AutomorphismGroup(F, S, idxA, ntuple(i -> gens(F, i), n))
|
return AutomorphismGroup(F, S, idxA, ntuple(i -> gens(F, i), n))
|
||||||
end
|
end
|
||||||
|
|
||||||
KnuthBendix.alphabet(G::AutomorphismGroup{<:FreeGroup}) = alphabet(rewriting(G))
|
|
||||||
|
|
||||||
function relations(G::AutomorphismGroup{<:FreeGroup})
|
function relations(G::AutomorphismGroup{<:FreeGroup})
|
||||||
n = length(alphabet(object(G))) ÷ 2
|
n = length(alphabet(object(G))) ÷ 2
|
||||||
return last(gersten_relations(n, commutative = false))
|
return last(gersten_relations(n, commutative = false))
|
||||||
|
@ -4,15 +4,15 @@ function KnuthBendix.Alphabet(S::AbstractVector{<:GSymbol})
|
|||||||
return Alphabet(S, inversions)
|
return Alphabet(S, inversions)
|
||||||
end
|
end
|
||||||
|
|
||||||
struct AutomorphismGroup{G<:Group,T,R,S} <: AbstractFPGroup
|
struct AutomorphismGroup{G<:Group,T,RW,S} <: AbstractFPGroup
|
||||||
group::G
|
group::G
|
||||||
gens::Vector{T}
|
gens::Vector{T}
|
||||||
rws::R
|
rw::RW
|
||||||
domain::S
|
domain::S
|
||||||
end
|
end
|
||||||
|
|
||||||
object(G::AutomorphismGroup) = G.group
|
object(G::AutomorphismGroup) = G.group
|
||||||
rewriting(G::AutomorphismGroup) = G.rws
|
rewriting(G::AutomorphismGroup) = G.rw
|
||||||
|
|
||||||
function equality_data(f::AbstractFPGroupElement{<:AutomorphismGroup})
|
function equality_data(f::AbstractFPGroupElement{<:AutomorphismGroup})
|
||||||
imf = evaluate(f)
|
imf = evaluate(f)
|
||||||
|
22
src/types.jl
22
src/types.jl
@ -7,7 +7,9 @@ An Abstract type representing finitely presented groups. Every instance must imp
|
|||||||
* `KnuthBendix.alphabet(G::MyFPGroup)`
|
* `KnuthBendix.alphabet(G::MyFPGroup)`
|
||||||
* `rewriting(G::MyFPGroup)` : return the rewriting object which must implement
|
* `rewriting(G::MyFPGroup)` : return the rewriting object which must implement
|
||||||
> `KnuthBendix.rewrite!(u, v, rewriting(G))`.
|
> `KnuthBendix.rewrite!(u, v, rewriting(G))`.
|
||||||
By default `alphabet(G)` is returned, which amounts to free rewriting in `G`.
|
E.g. for `G::FreeGroup` `alphabet(G)` is returned, which amounts to free rewriting.
|
||||||
|
* `ordering(G::MyFPGroup)[ = KnuthBendix.ordering(rewriting(G))]` : return the
|
||||||
|
(implicit) ordering for the alphabet of `G`.
|
||||||
* `relations(G::MyFPGroup)` : return a set of defining relations.
|
* `relations(G::MyFPGroup)` : return a set of defining relations.
|
||||||
|
|
||||||
AbstractFPGroup may also override `word_type(::Type{MyFPGroup}) = Word{UInt8}`,
|
AbstractFPGroup may also override `word_type(::Type{MyFPGroup}) = Word{UInt8}`,
|
||||||
@ -34,11 +36,14 @@ in free rewriting. For `FPGroup` a rewriting system is returned which may
|
|||||||
"""
|
"""
|
||||||
function rewriting end
|
function rewriting end
|
||||||
|
|
||||||
|
KnuthBendix.ordering(G::AbstractFPGroup) = ordering(rewriting(G))
|
||||||
|
KnuthBendix.alphabet(G::AbstractFPGroup) = alphabet(ordering(G))
|
||||||
|
|
||||||
Base.@propagate_inbounds function (G::AbstractFPGroup)(
|
Base.@propagate_inbounds function (G::AbstractFPGroup)(
|
||||||
word::AbstractVector{<:Integer},
|
word::AbstractVector{<:Integer},
|
||||||
)
|
)
|
||||||
@boundscheck @assert all(
|
@boundscheck @assert all(
|
||||||
l -> 1 <= l <= length(KnuthBendix.alphabet(G)),
|
l -> 1 <= l <= length(alphabet(G)),
|
||||||
word,
|
word,
|
||||||
)
|
)
|
||||||
return FPGroupElement(word_type(G)(word), G)
|
return FPGroupElement(word_type(G)(word), G)
|
||||||
@ -192,10 +197,9 @@ Base.show(io::IO, F::FreeGroup) =
|
|||||||
print(io, "free group on $(ngens(F)) generators")
|
print(io, "free group on $(ngens(F)) generators")
|
||||||
|
|
||||||
# mandatory methods:
|
# mandatory methods:
|
||||||
relations(F::FreeGroup) = Pair{eltype(F)}[]
|
|
||||||
KnuthBendix.ordering(F::FreeGroup) = F.ordering
|
KnuthBendix.ordering(F::FreeGroup) = F.ordering
|
||||||
KnuthBendix.alphabet(F::FreeGroup) = alphabet(KnuthBendix.ordering(F))
|
rewriting(F::FreeGroup) = alphabet(F) # alphabet(F) = alphabet(ordering(F))
|
||||||
rewriting(F::FreeGroup) = alphabet(F)
|
relations(F::FreeGroup) = Pair{eltype(F),eltype(F)}[]
|
||||||
|
|
||||||
# GroupsCore interface:
|
# GroupsCore interface:
|
||||||
# these are mathematically correct
|
# these are mathematically correct
|
||||||
@ -206,16 +210,14 @@ GroupsCore.isfiniteorder(g::AbstractFPGroupElement{<:FreeGroup}) =
|
|||||||
|
|
||||||
## FP Groups
|
## FP Groups
|
||||||
|
|
||||||
struct FPGroup{T,R,S} <: AbstractFPGroup
|
struct FPGroup{T,RW,S} <: AbstractFPGroup
|
||||||
gens::Vector{T}
|
gens::Vector{T}
|
||||||
relations::Vector{Pair{S,S}}
|
relations::Vector{Pair{S,S}}
|
||||||
rws::R
|
rw::RW
|
||||||
end
|
end
|
||||||
|
|
||||||
relations(G::FPGroup) = G.relations
|
relations(G::FPGroup) = G.relations
|
||||||
rewriting(G::FPGroup) = G.rws
|
rewriting(G::FPGroup) = G.rw
|
||||||
KnuthBendix.ordering(G::FPGroup) = KnuthBendix.ordering(rewriting(G))
|
|
||||||
KnuthBendix.alphabet(G::FPGroup) = alphabet(KnuthBendix.ordering(G))
|
|
||||||
|
|
||||||
function FPGroup(
|
function FPGroup(
|
||||||
G::AbstractFPGroup,
|
G::AbstractFPGroup,
|
||||||
|
Loading…
Reference in New Issue
Block a user