Rules

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

template<typename S, typename T>
inline Presentation &libsemigroups::Presentation::add_rule(S lhs_begin, S lhs_end, T rhs_begin, T rhs_end)

Add a rule to the presentation.

Adds the rule with left hand side [lhs_begin, lhs_end) and right hand side [rhs_begin, rhs_end) to the rules.

Warning

It is not checked that the arguments describe words over the alphabet of the presentation.

Template Parameters
  • S – the type of the first two parameters (iterators, or pointers)

  • T – the type of the second two parameters (iterators, or pointers)

Parameters
  • lhs_begin – an iterator pointing to the first letter of the left hand side of the rule to be added

  • lhs_end – an iterator pointing one past the last letter of the left hand side of the rule to be added

  • rhs_begin – an iterator pointing to the first letter of the right hand side of the rule to be added

  • rhs_end – an iterator pointing one past the last letter of the right hand side of the rule to be added

Throws

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

Returns

A const reference to *this

template<typename S, typename T>
inline Presentation &libsemigroups::Presentation::add_rule_and_check(S lhs_begin, S lhs_end, T rhs_begin, T rhs_end)

Add a rule to the presentation and check it is valid.

Adds the rule with left hand side [lhs_begin, lhs_end) and right hand side [rhs_begin, rhs_end) to the rules and checks that they only contain letters in alphabet. It is possible to add rules directly via the data member rules, this function just exists to encourage adding rules with both sides defined at the same time.

See also

add_rule

Template Parameters
  • S – the type of the first two parameters (iterators, or pointers)

  • T – the type of the second two parameters (iterators, or pointers)

Parameters
  • lhs_begin – an iterator pointing to the first letter of the left hand side of the rule to be added

  • lhs_end – an iterator pointing one past the last letter of the left hand side of the rule to be added

  • rhs_begin – an iterator pointing to the first letter of the right hand side of the rule to be added

  • rhs_end – an iterator pointing one past the last letter of the right hand side of the rule to be added

Throws
Returns

A const reference to *this

std::vector<word_type> libsemigroups::Presentation::rules

Data member holding the rules of the presentation.

The rules can be altered using the member functions of std::vector, and the presentation can be checked for validity using validate.