Presentation¶
This page describes the functionality in
Presentation
.The objects returned by
Presentation
can be used to construction presentations for semigroups or monoids and is intended to be used as the input to other algorithms. The idea is to provide a shallow wrapper around a list of words represented by lists of integers or strings. We refer to this list of words as the rules of the presentation. The objects returned byPresentation
also provide some methods for checking that the rules really defines a presentation, (i.e. it's consistent with its alphabet). Some related functionality is available inlibsemigroups_pybind11.presentation
.While
Presentation
is not a class, the objects returned byPresentation
have identical methods, and so we documentPresentation
as if it was a class.
Contents¶
Construct a presentation instance. |
|
The rules of the presentation. |
|
Overloaded function. |
|
Set the alphabet to be the letters in the rules. |
|
Overloaded function. |
|
Get the index of a letter in the alphabet. |
|
Get a letter in the alphabet by index. |
|
Check if the alphabet and rules are valid, and raise an exception if not. |
|
Check if the alphabet is valid, and raise an exception if not. |
|
Check if a letter belongs to the alphabet or not, and raise an exception if not. |
|
Check if every rule consists of letters belonging to the alphabet, and raise an exception if not. |
Full API¶
- class Presentation(alph: Union[str, List[int]])¶
Construct a presentation instance with alphabet
alph
. Note thatalph
can be the empty string or empty list.
- Presentation.rules¶
Data member containing the rules of the presentation.
- Presentation.alphabet(self: Presentation) Union[str, List[int]] ¶
Return the alphabet of the presentation.
- Parameters
None
- Returns
The alphabet of the presentation
self
.
- Presentation.alphabet(self: Presentation, alph: Union[str, List[int]]) Presentation
Set the alphabet of the presentation to
alph
. The argumentalph
must match the type of the argument with which the presentationself
was initialised.
- Presentation.alphabet(self: Presentation, size: int) Presentation
Set the alphabet by specifying its size
size
.- Parameters
size (int) -- the size to which the alphabet is set.
- Returns
The presentation instance
self
.
- Presentation.alphabet_from_rules(self: Presentation) Presentation ¶
Set the alphabet to be the letters in its rules (see
Presentation.rules
).- Parameters
None
- Returns
The presentation instance
self
.
- Presentation.contains_empty_word(self: Presentation) bool ¶
Check if the presentation is allowed to contain the empty word; that is, whether the presentation is a semigroup presentation or a monoid presentation.
- Parameters
None
- Returns
A bool.
- Presentation.contains_empty_word(self: Presentation, val: bool) Presentation
Specify whether the presentation should (not) contain the empty word; that is, whether the presentation is a semigroup presentation or a monoid presentation.
In order for a presentation which contains the empty word in any of its rules to be valid (see
validate_rules()
), this value must be set toTrue
.- Parameters
val (bool) -- whether or not the presentation should contain the empty word.
- Returns
The presentation instance
self
.
- Presentation.index(self: Presentation, val: int) int ¶
Get the index of a letter in the alphabet.
- Presentation.letter(self: Presentation, i: int) Union[int, str] ¶
Get a letter in the alphabet by index.
- Presentation.validate(self: Presentation) None ¶
Check if the alphabet and rules are valid, and raise an exception if not.
- Parameters
None
- Returns
None
- Raises
RuntimeError --
- Presentation.validate_alphabet(self: Presentation) None ¶
Check if the alphabet is valid, and raise an exception if not.
- Parameters
None
- Returns
None
- Raises
RuntimeError --
- Presentation.validate_letter(self: Presentation, c: Union[int, str]) None ¶
Check if a letter belongs to the alphabet or not, and raise an exception if not.
- Parameters
- Returns
None
- Raises
RuntimeError --
- Presentation.validate_rules(self: Presentation) None ¶
Check if every rule consists of letters belonging to the alphabet, and raise an exception if not.
If the presentation is a semigroup presentation rather than a monoid presentation (see
contains_empty_word()
), an exception is raised if any rule contains the empty word.- Parameters
None
- Returns
None
- Raises
RuntimeError --