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 - Kambitesinstance.- Keyword Arguments:
- word (type) – the type of words to use, must be either - stror- list[int]
 
 
 - __init__(self: Kambites, knd: congruence_kind, p: Presentation) None
- Construct from - congruence_kindand- Presentation.- This function constructs a - Kambitesinstance representing a congruence of kind knd over the semigroup or monoid defined by the presentation p.- Kambitesinstances can only be used to compute two-sided congruences, and so the first parameter knd must always be- congruence_kind.twosided. The parameter knd is included for uniformity of interface between with- KnuthBendix,- ToddCoxeter, and- Congruence.- 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 - Kambitesinstance.- 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()and- Presentation.throw_if_letter_not_in_alphabetraises.
- LibsemigroupsError – if - Runner.startedreturns- True.
- 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 - Kambitesinstance.- 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()and- Presentation.throw_if_letter_not_in_alphabetraises.
- LibsemigroupsError – if - small_overlap_classis 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 - Kambitesinstance. 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.trueif the words are known to belong to the congruence;
- tril.falseif the words are known to not belong to the congruence;
- tril.unknownotherwise.
 
- 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()and- Presentation.throw_if_letter_not_in_alphabetraises.
- LibsemigroupsError – if - small_overlap_classis 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 - Kambitesinstance.- This function puts a - Kambitesinstance 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 - Kambitesinstance.- This function re-initializes a - Kambitesinstance 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_kindfor 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 - Kambitesinstance.- This function computes the number of classes in the congruence represented by a - Kambitesinstance if the- small_overlap_classis at least \(4\).- Kambitesinstances 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 always- POSITIVE_INFINITY. Otherwise an exception is raised.- Returns:
- The number of congruence classes of a - Kambitesinstance if this number is finite, or- POSITIVE_INFINITYin 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 - Kambitesinstance (if any). If a- Kambitesinstance is constructed or initialised using a presentation, then this presentation is returned by this function.- Returns:
- The presentation used to construct or initialise a - Kambitesinstance.
- Return type:
 
 - reduce(self: Kambites, w: list[int] | str) list[int] | str
- Reduce a word. - This function triggers a full enumeration of an - Kambitesobject and then reduces the word w. As such the returned word is a normal form for the input word.- If the - Kambites.small_overlap_classis 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()and- Presentation.throw_if_letter_not_in_alphabetraises.
- LibsemigroupsError – if - small_overlap_classis not at least \(4\).
 
 
 - reduce_no_run(self: Kambites, w: list[int] | str) list[int] | str
- Reduce a word. - If - Runner.finishedreturns- True, then this function returns a normal form for the input word w.- If the - Kambites.small_overlap_classis 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()and- Presentation.throw_if_letter_not_in_alphabetraises.
 
 - 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_INFINITYif 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 - Ukkonenobject containing the relation words of a- Kambitesobject, that is used to determine the pieces, and decompositions of the relation words.- Returns:
- The generalised suffix tree containing the relation words. 
- Return type: