Rules¶
This page contains information about the functionality for manipulating the rules of a Presentation
object.
-
template<typename T>
inline Presentation &libsemigroups::Presentation::add_rule(T lhs_begin, T 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.See also
Warning
It is not checked that the arguments describe words over the alphabet of the presentation.
- 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 T>
inline Presentation &libsemigroups::Presentation::add_rule_and_check(T lhs_begin, T 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
- 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
LibsemigroupsException – if any letter does not below to the alphabet
LibsemigroupsException – if contains_empty_word returns
false
andlhs_begin
equalslhs_end
orrhs_begin
equalsrhs_end
- 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.