Presentations

This module contains the classes MonoidPresentation and InverseMonoidPresentation which can be used to define presentations. These serve as part of the input to the main algorithms implemented in this package in stephen.wordgraph.WordGraph, stephen.schutzenbergergraph.SchutzenbergerGraph, and stephen.Stephen.

class step_hen.presentation.MonoidPresentation

This class is used to define monoid presentations. The alphabet is set using the method set_alphabet(), and relations can be added using add_relation().

__init__()

Constructs an empty presentation.

add_relation(word1: str, word2: str)None

Add a relation to the presentation.

Parameters
  • word1 – the left hand side of the relation to add.

  • word2 – the right hand side of the relation to add.

Returns

None.

Raises
  • ValueError – If the alphabet has not been defined.

  • ValueError – If word1 or word2 contains a letter not in the alphabet.

  • TypeError – If word1 or word2 is not a string.

set_alphabet(alphabet: str)None

Set the alphabet of the presentation.

Parameters

alphabet – the string containing the alphabet.

Returns

None.

Raises
  • ValueError – If the alphabet has already been set.

  • ValueError – If the parameter alphabet contains duplicate letters.

  • TypeError – If the alphabet is not a string.`

class step_hen.presentation.InverseMonoidPresentation

This class is used to define inverse monoid presentations. The alphabet is set using the method set_alphabet(), and relations can be added using add_relation().

Letters in the alphabet must be lower case, and upper case letters are used for the inverse of a letter.

__init__()

Constructs an empty presentation.

set_alphabet(alphabet: str)None

Set the alphabet of the presentation.

Parameters

alphabet – the string containing the alphabet.

Returns

None.

Raises
  • ValueError – If the alphabet has already been set.

  • ValueError – If the parameter alphabet contains duplicate letters.

  • ValueError – If the parameter alphabet contains upper case letters.

  • TypeError – If the alphabet is not a string.`