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 by Presentation 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 in libsemigroups_pybind11.presentation.

While Presentation is not a class, the objects returned by Presentation have identical methods, and so we document Presentation as if it was a class.

Contents

Presentation()

Construct a presentation instance.

Presentation.rules

The rules of the presentation.

Presentation.alphabet()

Overloaded function.

Presentation.alphabet_from_rules()

Set the alphabet to be the letters in the rules.

Presentation.contains_empty_word()

Overloaded function.

Presentation.index()

Get the index of a letter in the alphabet.

Presentation.letter()

Get a letter in the alphabet by index.

Presentation.validate()

Check if the alphabet and rules are valid, and raise an exception if not.

Presentation.validate_alphabet()

Check if the alphabet is valid, and raise an exception if not.

Presentation.validate_letter()

Check if a letter belongs to the alphabet or not, and raise an exception if not.

Presentation.validate_rules()

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 that alph 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 argument alph must match the type of the argument with which the presentation self was initialised.

Parameters

alph (str or List[int]) -- the alphabet.

Returns

The presentation instance self.

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 to True.

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.

Parameters

val (int or str) -- the letter.

Returns

The index of val in the alphabet of the presentation self.

Presentation.letter(self: Presentation, i: int) Union[int, str]

Get a letter in the alphabet by index.

Parameters

i (int or str) -- the index.

Returns

The letter in the alphabet of the presentation self with index i.

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

c (int or str) -- the letter to check.

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 --