1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-25 18:15:29 +01:00

replace KB.rewrite_from_left! → KB.rewrite!

This commit is contained in:
Marek Kaluba 2022-10-13 23:30:55 +02:00
parent 42d4c41d90
commit 1345516521
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 13 additions and 12 deletions

View File

@ -42,5 +42,5 @@ Defaults to the rewriting in the free group.
""" """
@inline function normalform!(res::AbstractWord, g::AbstractFPGroupElement) @inline function normalform!(res::AbstractWord, g::AbstractFPGroupElement)
isone(res) && isnormalform(g) && return append!(res, word(g)) isone(res) && isnormalform(g) && return append!(res, word(g))
return KnuthBendix.rewrite_from_left!(res, word(g), rewriting(parent(g))) return KnuthBendix.rewrite!(res, word(g), rewriting(parent(g)))
end end

View File

@ -3,15 +3,16 @@
""" """
AbstractFPGroup AbstractFPGroup
An Abstract type representing finitely presented groups. Every instance `` must implement An Abstract type representing finitely presented groups. Every instance must implement
* `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_from_left!(u, v, rewriting(G))`. > `KnuthBendix.rewrite!(u, v, rewriting(G))`.
By default `alphabet(G)` is returned, which amounts to free rewriting in `G`. By default `alphabet(G)` is returned, which amounts to free rewriting in `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{UInt16}`, AbstractFPGroup may also override `word_type(::Type{MyFPGroup}) = Word{UInt8}`,
which controls the word type used for group elements. If a group has more than `255` generators you need to define e.g. which controls the word type used for group elements.
If a group has more than `255` generators you need to define e.g.
> `word_type(::Type{MyFPGroup}) = Word{UInt16}` > `word_type(::Type{MyFPGroup}) = Word{UInt16}`
""" """
abstract type AbstractFPGroup <: GroupsCore.Group end abstract type AbstractFPGroup <: GroupsCore.Group end
@ -22,14 +23,14 @@ word_type(::Type{<:AbstractFPGroup}) = Word{UInt8}
""" """
rewriting(G::AbstractFPGroup) rewriting(G::AbstractFPGroup)
Return a "rewriting object" for elements of `G`. The rewriting object must must implement Return a "rewriting object" for elements of `G`.
KnuthBendix.rewrite_from_left!(
u::AbstractWord,
v::AbstractWord,
rewriting(G)
)
For example if `G` is a `FreeGroup` then `alphabet(G)` is returned which results in free rewriting. For `FPGroup` a rewriting system is returned which may (or may not) rewrite word `v` to its normal form. The rewriting object must must implement
KnuthBendix.rewrite!(u::AbstractWord, v::AbstractWord, rewriting(G))
For example if `G` is a `FreeGroup` then `alphabet(G)` is returned which results
in free rewriting. For `FPGroup` a rewriting system is returned which may
(or may not) rewrite word `v` to its normal form (depending on e.g. its confluence).
""" """
function rewriting end function rewriting end