The Kambites class
Class implementing small overlap class, equality, and normal forms for small overlap monoids.
This page describes the class Kambites
for determining the
small overlap class of a presentation, and, for small overlap monoids (those
with small overlap class 4 or higher) checking equality of words and for
computing normal forms. Note that a Kambites
instance represents a
congruence on the free monoid or semigroup containing the rules of a
presentation used to construct the instance, and the
Kambites.generating_pairs
. As such generating pairs or rules are
interchangeable in the context of Kambites
objects.
See also
Contents
Class implementing small overlap class, equality, and normal forms for small overlap monoids. |
|
Add a generating pair. |
|
Check containment of a pair of words. |
|
Copy a |
|
Check whether a pair of words is already known to belong to the congruence. |
|
Get the generating pairs of the congruence. |
|
Overloaded function. |
|
The kind of the congruence (1- or 2-sided). |
|
Compute the number of classes in the congruence. |
|
Returns the number of generating pairs. |
|
Get the presentation used to define a |
|
Reduce a word. |
|
Reduce a word. |
|
Get the small overlap class. |
|
Returns the generalised suffix tree used to compute pieces. |
Full API
- class Kambites
- __init__(*args, **kwargs)
Overloaded function.
- __init__(word: type) None
Default constructor.
This function default constructs an uninitialised
Kambites
instance.- Keyword Arguments:
word (type) – the type of words to use, must be either
str
orlist[int]
- __init__(self: Kambites, knd: congruence_kind, p: Presentation) None
Construct from
congruence_kind
andPresentation
.This function constructs a
Kambites
instance representing a congruence of kind knd over the semigroup or monoid defined by the presentation p.Kambites
instances can only be used to compute two-sided congruences, and so the first parameter knd must always becongruence_kind.twosided
. The parameter knd is included for uniformity of interface between withKnuthBendix
,ToddCoxeter
, andCongruence
.- Parameters:
knd (congruence_kind) – the kind (onesided or twosided) of the congruence.
p (Presentation) – the presentation.
- Raises:
LibsemigroupsError – if knd is not
congruence_kind.twosided
.LibsemigroupsError – if p is not valid.
- add_generating_pair(self: Kambites, u: list[int] | str, v: list[int] | str) Kambites
Add a generating pair.
This function adds a generating pair to the congruence represented by a
Kambites
instance.- Parameters:
- Returns:
self.
- Return type:
- Raises:
LibsemigroupsError – if any of the values in u or v is out of range, i.e. they do not belong to
presentation().alphabet()
andPresentation.throw_if_letter_not_in_alphabet
raises.LibsemigroupsError – if
Runner.started
returnsTrue
.TypeError – if the type of the arguments is not the same as the type of the words in
Kambites.presentation
.
- contains(self: Kambites, u: list[int] | str, v: list[int] | str) bool
Check containment of a pair of words.
This function checks whether or not the words u and v are contained in the congruence represented by a
Kambites
instance.- Parameters:
- Returns:
Whether or not the pair belongs to the congruence.
- Return type:
- Raises:
LibsemigroupsError – if any of the values in u or v is out of range, i.e. they do not belong to
presentation().alphabet()
andPresentation.throw_if_letter_not_in_alphabet
raises.LibsemigroupsError – if
small_overlap_class
is not at least \(4\).
- currently_contains(self: Kambites, u: list[int] | str, v: list[int] | str) tril
Check whether a pair of words is already known to belong to the congruence.
This function checks whether or not the words u and v are already known to be contained in the congruence represented by a
Kambites
instance. This function performs no enumeration, so it is possible for the words to be contained in the congruence, but that this is not currently known.- Parameters:
- Returns:
tril.true
if the words are known to belong to the congruence;tril.false
if the words are known to not belong to the congruence;tril.unknown
otherwise.
- Return type:
- Raises:
LibsemigroupsError – if any of the values in u or v is out of range, i.e. they do not belong to
presentation().alphabet()
andPresentation.throw_if_letter_not_in_alphabet
raises.LibsemigroupsError – if
small_overlap_class
is known and not at least \(4\).
- generating_pairs(self: Kambites) list[list[int] | str]
Get the generating pairs of the congruence.
This function returns the generating pairs of the congruence as added via
Kambites.add_generating_pair
.
- init(*args, **kwargs)
Overloaded function.
- init(self: Kambites) Kambites
Re-initialize a
Kambites
instance.This function puts a
Kambites
instance back into the state that it would have been in if it had just been newly default constructed.- Returns:
self.
- Return type:
- init(self: Kambites, knd: congruence_kind, p: Presentation) Kambites
Re-initialize a
Kambites
instance.This function re-initializes a
Kambites
instance as if it had been newly constructed from knd and p.- Parameters:
knd (
congruence_kind
) – the kind (onesided or twosided) of the congruence.p (Presentation) – the presentation.
- Returns:
self.
- Return type:
- Raises:
LibsemigroupsError – if p is not valid.
LibsemigroupsError – if knd is not
congruence_kind.twosided
.
- kind(self: Congruence | Kambites | KnuthBendix | ToddCoxeter) congruence_kind
The kind of the congruence (1- or 2-sided).
This function returns the kind of the congruence represented by self. See
congruence_kind
for details.- Returns:
The kind of the congruence (1- or 2-sided).
- Return type:
- Complexity:
Constant.
- number_of_classes(self: Kambites) int | PositiveInfinity
Compute the number of classes in the congruence. This function computes the number of classes in the congruence represented by a
Kambites
instance.This function computes the number of classes in the congruence represented by a
Kambites
instance if thesmall_overlap_class
is at least \(4\).Kambites
instances can only compute the number of classes if the condition of the previous sentence is fulfilled, and in this case the number of classes is alwaysPOSITIVE_INFINITY
. Otherwise an exception is raised.- Returns:
The number of congruence classes of a
Kambites
instance if this number is finite, orPOSITIVE_INFINITY
in some cases if this number is not finite.- Return type:
- Raises:
LibsemigroupsError – if knd is not
congruence_kind.twosided
.
- number_of_generating_pairs(self: Congruence | Kambites | KnuthBendix | ToddCoxeter) int
Returns the number of generating pairs.
This function returns the number of generating pairs of the congruence.
- Returns:
The number of generating pairs.
- Return type:
- Complexity:
Constant.
- presentation(self: Kambites) Presentation
Get the presentation used to define a
Kambites
instance (if any). If aKambites
instance is constructed or initialised using a presentation, then this presentation is returned by this function.- Returns:
The presentation used to construct or initialise a
Kambites
instance.- Return type:
- reduce(self: Kambites, w: list[int] | str) list[int] | str
Reduce a word.
This function triggers a full enumeration of an
Kambites
object and then reduces the word w. As such the returned word is a normal form for the input word.If the
Kambites.small_overlap_class
is not at least \(4\), then an exception is thrown.- Parameters:
- Returns:
A normal form for the input word.
- Return type:
- Raises:
LibsemigroupsError – if any of the values in w is out of range, i.e. they do not belong to
presentation().alphabet()
andPresentation.throw_if_letter_not_in_alphabet
raises.LibsemigroupsError – if
small_overlap_class
is not at least \(4\).
- reduce_no_run(self: Kambites, w: list[int] | str) list[int] | str
Reduce a word.
If
Runner.finished
returnsTrue
, then this function returns a normal form for the input word w.If the
Kambites.small_overlap_class
is not at least \(4\), then an exception is thrown.- Parameters:
- Returns:
A word equivalent to the input word.
- Return type:
- Raises:
LibsemigroupsError – if any of the values in w is out of range, i.e. they do not belong to
presentation().alphabet()
andPresentation.throw_if_letter_not_in_alphabet
raises.
- small_overlap_class(self: Kambites) int | PositiveInfinity
Get the small overlap class.
If \(S\) is a finitely presented semigroup or monoid with generating set \(A\), then a word \(w\) over \(A\) is a piece if \(w\) occurs as a factor in at least two of the relations defining \(S\) or if it occurs as a factor of one relation in two different positions (possibly overlapping). A finitely presented semigroup \(S\) satisfies the condition \(C(n)\), for a positive integer \(n\) if the minimum number of pieces in any factorisation of a word occurring as the left or right hand side of a relation of \(S\) is at least \(n\).
- Returns:
The greatest positive integer \(n\) such that the finitely semigroup or monoid represented by self satisfies the condition \(C(n)\) ; or
POSITIVE_INFINITY
if no word occurring in a relation can be written as a product of pieces.- Return type:
- Complexity:
The current implementation has complexity no worse than \(O(m ^ 3)\) where \(m\) is the sum of the lengths of the words occurring in the relations of the semigroup.
- ukkonen(self: Kambites) Ukkonen
Returns the generalised suffix tree used to compute pieces.
This function returns the generalised suffix tree
Ukkonen
object containing the relation words of aKambites
object, that is used to determine the pieces, and decompositions of the relation words.- Returns:
The generalised suffix tree containing the relation words.
- Return type: