![]() |
libsemigroups
v3.0.3
C++ library for semigroups and monoids
|
Defined in rewriters.hpp.
This class implements a data structure for storing rewriting rules. Here, a rewriting rule is a rule of the form \(A \to B\), where \(A\) and \(B\) are both words over some alphabet \(\Sigma\).
The left-hand and right-hand sides of a rule are specified externally with the type external_string_type, and stored internally with type internal_string_type.
Public Member Functions | |
| Rule (int64_t id) | |
| Construct with new empty left-hand and right-hand sides. | |
| Rule (Rule &©)=delete | |
| Rule (Rule const ©)=delete | |
| void | activate () noexcept |
| Activate a rule. | |
| bool | active () const noexcept |
| Check if the Rule is active. | |
| void | deactivate () noexcept |
| Deactivate a rule. | |
| bool | empty () const noexcept |
| Check if the left-hand and right-hand sides are empty. | |
| int64_t | id () const noexcept |
| Return the id of a rule. | |
| internal_string_type * | lhs () const noexcept |
| Return the left-hand side of the rule. | |
| Rule & | operator= (Rule &©)=delete |
| Rule & | operator= (Rule const ©)=delete |
| void | reorder () |
| Reorder the left-hand and right-hand sides. | |
| internal_string_type * | rhs () const noexcept |
| Return the right-hand side of the rule. | |
| void | set_id (int64_t id) |
| Set the id of a rule. | |
| void | set_id_no_checks (int64_t id) noexcept |
| Set the id of a rule. | |
|
explicit |
Construct with new empty left-hand and right-hand sides.
| id | the id of the new rule. |
|
noexcept |
Activate a rule, if it is inactive.
noexcept and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Check if the rule is active.
bool.noexcept and is guaranteed never to throw.
|
noexcept |
Deactivate a rule, if it is active.
noexcept and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Check if the words pointed to by both the left-hand and the right-hand sides are empty.
bool.noexcept and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Return the id of a rule.
int64_tnoexcept and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Return the left-hand side of the rule. If this rule was create by a KnuthBendix, this is guaranteed to be greater than its right-hand side according to the reduction ordering of that KnuthBendix.
noexcept and is guaranteed never to throw.
|
inline |
If the right-hand side is greater than the left-hand side of a rule, with regards to length-lexicographical order, then swap them.
|
inlinenodiscardnoexcept |
Return the right-hand side of the rule. If this rule was create by a KnuthBendix, this is guaranteed to be less than its left-hand side according to the reduction ordering of that KnuthBendix.
noexcept and is guaranteed never to throw.
|
inline |
After checking that the Rule is inactive id is positive, this function performs the same as set_id_no_checks.
| LIBSEMIGROUPS_EXCEPTION | if id is non-positive, or if this is active. |
|
inlinenoexcept |
Set the id of a rule.
| id | the id to set. |
noexcept and is guaranteed never to throw.