From 20711aa1e8ef07a69140316f6b0ecf87ab990f6d Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Sat, 18 Dec 2021 21:57:41 +0100 Subject: [PATCH] remove the default rewriting(G::AbstractFPGroup) It's better to show MethodError than to default to surprising behaviour. --- src/types.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/types.jl b/src/types.jl index a5002ae..a96e5dc 100644 --- a/src/types.jl +++ b/src/types.jl @@ -20,8 +20,18 @@ word_type(G::AbstractFPGroup) = word_type(typeof(G)) # the default: word_type(::Type{<:AbstractFPGroup}) = Word{UInt8} -# the default (results in free rewriting) -rewriting(G::AbstractFPGroup) = alphabet(G) +""" + rewriting(G::AbstractFPGroup) +Return a "rewriting object" for elements of `G`. The rewriting object must must implement + 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. +""" +function rewriting end Base.@propagate_inbounds function (G::AbstractFPGroup)( word::AbstractVector{<:Integer},