Common methods
This page contains documentation of the methods of ToddCoxeter that are
implemented in all of the classes Congruence, Kambites,
KnuthBendix, and ToddCoxeter.
- ToddCoxeter.add_generating_pair(self: ToddCoxeter, u: list[int] | str, v: list[int] | str) ToddCoxeter
- Add a generating pair. - This function adds a generating pair to the congruence represented by a - ToddCoxeterinstance.- 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.
 
 
- ToddCoxeter.contains(self: ToddCoxeter, 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 - ToddCoxeterinstance.- 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.
 
- ToddCoxeter.currently_contains(self: ToddCoxeter, 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 - ToddCoxeterinstance. 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.
 
- ToddCoxeter.generating_pairs(self: ToddCoxeter) list[list[int] | str]
- Get the generating pairs of the congruence. - This function returns the generating pairs of the congruence as added via - ToddCoxeter.add_generating_pair.
- ToddCoxeter.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. 
 
- ToddCoxeter.number_of_classes(self: ToddCoxeter) int | PositiveInfinity
- Compute the number of classes in the congruence. This function computes the number of classes in the congruence represented by a - ToddCoxeterinstance.- Returns:
- The number of congruence classes of a - ToddCoxeterinstance if this number is finite, or- POSITIVE_INFINITYin some cases if this number is not finite.
- Return type:
 
- ToddCoxeter.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. 
 
- ToddCoxeter.presentation(self: ToddCoxeter) Presentation
- Get the presentation used to define a - ToddCoxeterinstance (if any). If a- ToddCoxeterinstance is constructed or initialised using a presentation, then this presentation is returned by this function.- If the - ToddCoxeterinstance was constructed or initialised from a- WordGraph, then this presentation will be empty.- Returns:
- The presentation used to construct or initialise a - ToddCoxeterinstance.
- Return type:
 
- ToddCoxeter.reduce(self: ToddCoxeter, w: list[int] | str) list[int] | str
- Reduce a word. - This function triggers a full enumeration of an - ToddCoxeterobject and then reduces the word w. As such the returned word is a normal form for the input word.- 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.
 
- ToddCoxeter.reduce_no_run(self: ToddCoxeter, 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 - ToddCoxeterinstance is not- Runner.finished, then it might be that equivalent input words produce different output words. This function triggers no congruence enumeration.- 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.