Alphabet + letters

This page contains information about the functionality for manipulating the alphabet of a Presentation object.

inline word_type const &libsemigroups::Presentation::alphabet() const noexcept

Returns the alphabet of the presentation.

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Parameters

(None)

Returns

A const reference to Presentation::word_type

Presentation &libsemigroups::Presentation::alphabet(size_type n)

Set the alphabet by size.

Sets the alphabet to the range \([0, n)\) consisting of values of type letter_type

Warning

No checks are performed by this function, in particular, it is not verified that the rules in the presentation (if any) consist of letters belonging to the alphabet

Parameters

n – the size of the alphabet

Throws

LibsemigroupsException – if the value of n is greater than the maximum number of letters supported by letter_type.

Returns

A const reference to *this

Presentation &libsemigroups::Presentation::alphabet(word_type const &lphbt)

Set the alphabet const reference.

Sets the alphabet to be the letters in lphbt.

See also

validate_rules and validate

Warning

This function does not verify that the rules in the presentation (if any) consist of letters belonging to the alphabet

Parameters

lphbt – the alphabet

Throws

LibsemigroupsException – if there are duplicate letters in lphbt

Returns

A const reference to *this

Presentation &libsemigroups::Presentation::alphabet(word_type &&lphbt)

Set the alphabet from rvalue reference.

Sets the alphabet to be the letters in lphbt.

See also

validate_rules and validate

Warning

This function does not verify that the rules in the presentation (if any) consist of letters belonging to the alphabet

Parameters

lphbt – the alphabet

Throws

LibsemigroupsException – if there are duplicate letters in lphbt

Returns

A const reference to *this

Presentation &libsemigroups::Presentation::alphabet_from_rules()

Set the alphabet to be the letters in the rules.

Sets the alphabet to be the letters in rules.

See also

validate_rules, and validate

Parameters

(None)

Returns

A const reference to *this

inline bool libsemigroups::Presentation::contains_empty_word() const noexcept

Check if the presentation should contain the empty word.

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

A value of type bool

inline Presentation &libsemigroups::Presentation::contains_empty_word(bool val) noexcept

Specify that the presentation should (not) contain the empty word.

Parameters

val – whether the presentation should contain the empty word

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

A const reference to *this

inline bool libsemigroups::Presentation::in_alphabet(letter_type val) const

Check if a letter belongs to the alphabet or not.

This function guarantees not to throw a LibsemigroupsException.

Parameters

val – the letter to check

Returns

A value of type bool.

inline size_type libsemigroups::Presentation::index(letter_type val) const

Get the index of a letter in the alphabet.

Complexity

Constant.

Warning

This function does not verify that its argument belongs to the alphabet.

Parameters

val – the letter

Throws

(None) – This function guarantees not to throw a LibsemigroupsException.

Returns

A value of type size_type

inline letter_type libsemigroups::Presentation::letter(size_type i) const

Get a letter in the alphabet by index.

Returns the letter of the alphabet in position i

Warning

This function performs no bound checks on the argument i

Parameters

i – the index

Throws

(None) – This function guarantees not to throw a LibsemigroupsException.

Returns

A value of type letter_type