The InversePresentation class
For an implementation of inverse presentations for semigroups or monoids.
This class can be used to construction inverse presentations for semigroups or
monoids and is intended to be used as the input to other algorithms in
libsemigroups_pybind11.
This class inherits from Presentation.
Types
In what follows, we use the following pseudo-types:
Letterforstr | int
Wordforstr | list[int]
Recall that, once a presentation has been constructed, the type of its letters and words are fixed.
Contents
| For an implementation of inverse presentations for semigroups or monoids. | |
| Return the inverse of a letter in the alphabet. | |
| Overloaded function. | |
| 
 | Check if the  | 
Full API
- class InversePresentation
- __init__(*args, **kwargs)
- Overloaded function. - __init__(self: Presentation, word: type) None
- Default constructor. - This function default constructs an uninitialised - Presentationinstance.- Keyword Arguments:
- word (type) – the type of words to use. Must be either - stror- list[int].
 
 
 - __init__(self: Presentation, alphabet: str | list[int]) None
- Construct a presentation from an alphabet. - This function constructs a - Presentationinstance with the alphabet specified by alphabet.- Parameters:
- alphabet (str | list[int]) – the alphabet of the presentation. 
- Raises:
- LibsemigroupsError – if there are duplicate letters in alphabet. 
 
 - __init__(self: InversePresentation, p: Presentation) None
- Construct an - InversePresentation, initially with empty inverses, from a- Presentation.- Parameters:
- p (Presentation) – the - Presentationto construct from.
 
 
 - inverse(self: InversePresentation, x: Letter) Letter
- Return the inverse of a letter in the alphabet. - Returns the inverse of the letter x. - Parameters:
- x (Letter) – the letter whose index is sought. 
- Returns:
- the index of x. 
- Return type:
- Raises:
- LibsemigroupsError – if no inverses have been set, or if - index(x)throws.
 
 - inverses(*args, **kwargs)
- Overloaded function. - inverses(self: InversePresentation) Word
- Return the inverse of each letter in the alphabet. - Returns the inverse of each letter in the alphabet. - Returns:
- the inverses. 
- Return type:
 
 - inverses(self: InversePresentation, w: Word) InversePresentation
- Set the inverse of each letter in the alphabet. - Parameters:
- w (Word) – a word containing the inverses. 
- Returns:
- self. 
- Return type:
- Raises:
- LibsemigroupsError – if the alphabet contains duplicate letters. 
- LibsemigroupsError – if the inverses do not act as semigroup inverses. 
 
 - Note - Whilst the alphabet is not specified as an argument to this function, it is necessary to validate the alphabet here; a specification of inverses cannot make sense if the alphabet contains duplicate letters. 
 
 - throw_if_bad_alphabet_rules_or_inverses(self: InversePresentation) None
- Check if the - InversePresentationis valid.- Check if the - InversePresentationis valid. Specifically, check that the alphabet does not contain duplicate letters, that all rules only contain letters defined in the alphabet, and that the inverses act as semigroup inverses.- Raises:
- LibsemigroupsError – if the alphabet contains duplicate letters. 
- LibsemigroupsError – if the rules contain letters not defined in the alphabet. 
- LibsemigroupsError – if the inverses do not act as semigroup inverses.