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
ToddCoxeter
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
.
- 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
ToddCoxeter
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.
- 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
ToddCoxeter
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.
- 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_kind
for 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
ToddCoxeter
instance.- Returns:
The number of congruence classes of a
ToddCoxeter
instance if this number is finite, orPOSITIVE_INFINITY
in 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
ToddCoxeter
instance (if any). If aToddCoxeter
instance is constructed or initialised using a presentation, then this presentation is returned by this function.If the
ToddCoxeter
instance was constructed or initialised from aWordGraph
, then this presentation will be empty.- Returns:
The presentation used to construct or initialise a
ToddCoxeter
instance.- Return type:
- ToddCoxeter.reduce(self: ToddCoxeter, w: list[int] | str) list[int] | str
Reduce a word.
This function triggers a full enumeration of an
ToddCoxeter
object 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()
andPresentation.throw_if_letter_not_in_alphabet
raises.
- ToddCoxeter.reduce_no_run(self: ToddCoxeter, 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
ToddCoxeter
instance is notRunner.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()
andPresentation.throw_if_letter_not_in_alphabet
raises.