|
libsemigroups
|
This class is used to represent a string rewriting system defining a finitely presented monoid or semigroup. More...
#include <rws.h>
Classes | |
| class | Rule |
| Class for rules in rewriting systems, which supports only two methods, Rule::lhs and Rule::rhs, which return the left and right hand sides of the rule. More... | |
Public Member Functions | |
| RWS (ReductionOrdering *order) | |
Constructs rewriting system with no rules and the reduction ordering order. More... | |
| RWS () | |
| Constructs a rewriting system with no rules, and the SHORTLEX reduction ordering. More... | |
| RWS (std::vector< relation_t > const &relations) | |
Constructs a rewriting system with rules derived from the parameter relations, and with the SHORTLEX reduction ordering. More... | |
| RWS (ReductionOrdering *order, std::vector< relation_t > const &relations) | |
Constructs a rewriting system with rules derived from relations, and with the reduction ordering specified by order. More... | |
| RWS (Congruence &cong) | |
Constructs a rewriting system from Congruence::relations and Congruence::extra applied to cong. More... | |
| ~RWS () | |
| A default destructor. More... | |
| void | add_rule (rws_word_t *p, rws_word_t *q) |
| Add a rule to the rewriting system. More... | |
| void | add_rule (rws_word_t const &p, rws_word_t const &q) |
| Add a rule to the rewriting system. More... | |
| void | add_rules (std::vector< relation_t > const &relations) |
Adds rules derived from relations via RWS::word_to_rws_word to the rewriting system. More... | |
| void | add_rules (Congruence &cong) |
Add rules derived from Congruence::relations and Congruence::extra applied to cong. More... | |
| bool | is_confluent () const |
Returns true if the rewriting system is confluent and false if it is not. More... | |
| void | knuth_bendix () |
| Run the Knuth-Bendix algorithm on the rewriting system. More... | |
| void | knuth_bendix (std::atomic< bool > &killed) |
Run the Knuth-Bendix algorithm on the rewriting system until it terminates or killed is set to true. More... | |
| size_t | nr_rules () const |
| Returns the current number of active rules in the rewriting system. More... | |
| void | rewrite (rws_word_t *w) const |
Rewrites the word pointed to by w in-place according to the current rules in the rewriting system. More... | |
| rws_word_t | rewrite (rws_word_t w) const |
Rewrites a copy of the word w according to the current rules in the rewriting system. More... | |
| std::list< Rule const * >::const_iterator | rules_cbegin () const |
Returns an iterator pointing at the first Rule of this. More... | |
| std::list< Rule const * >::const_iterator | rules_cend () const |
Returns an iterator pointing past the last Rule of this. More... | |
| void | set_confluent (bool val) |
| If you somehow magically know that the rewriting system is confluent, or not, then you can set this using this method. More... | |
| void | set_report (bool val) const |
| Turn reporting on or off. More... | |
| bool | test_equals (word_t const &p, word_t const &q) |
Returns true if the reduced form of RWS::word_to_rws_word(p) equal the reduced form of RWS::word_to_rws_word(q), and false if not. More... | |
| bool | test_equals (rws_word_t const &p, rws_word_t const &q) |
Returns true if RWS::rewrite(p) equals RWS::rewrite(q), and false if not. More... | |
| bool | test_less_than (word_t const &p, word_t const &q) |
Returns true if the reduced form of RWS::word_to_rws_word(p) is less than the reduced form of RWS::word_to_rws_word(q), with respect to the reduction ordering of this, and false if not. More... | |
| bool | test_less_than (rws_word_t const &p, rws_word_t const &q) |
Returns true if RWS::rewrite(p) is less than RWS::rewrite(q), with respect to the reduction ordering of this, and false if not. More... | |
Static Public Member Functions | |
| static rws_letter_t | letter_to_rws_letter (letter_t const &a) |
| Helper function for converting a libsemigroups::letter_t to a libsemigroups::rws_letter_t. More... | |
| static rws_word_t * | letter_to_rws_word (letter_t const &a) |
| Helper function for converting a libsemigroups::letter_t to a libsemigroups::rws_word_t. More... | |
| static letter_t | rws_letter_to_letter (rws_letter_t const &rws_letter) |
| Helper function for converting a libsemigroups::rws_letter_t to a libsemigroups::letter_t. More... | |
| static word_t * | rws_word_to_word (rws_word_t const *rws_word) |
| Helper function for converting a libsemigroups::rws_word_t to a libsemigroups::word_t. More... | |
| static rws_word_t * | word_to_rws_word (word_t const &w) |
| Helper function for converting a libsemigroups::word_t to a libsemigroups::rws_word_t. More... | |
This class is used to represent a string rewriting system defining a finitely presented monoid or semigroup.
|
inlineexplicit |
Constructs rewriting system with no rules and the reduction ordering order.
This constructs a rewriting system with no rules, and with the reduction ordering ReductionOrdering specifed by the parameter order.
|
inline |
Constructs a rewriting system with no rules, and the SHORTLEX reduction ordering.
|
inlineexplicit |
Constructs a rewriting system with rules derived from the parameter relations, and with the SHORTLEX reduction ordering.
|
inline |
Constructs a rewriting system with rules derived from relations, and with the reduction ordering specified by order.
The RWS instance constructed here owns the parameter order, and deletes it in its destructor.
|
inlineexplicit |
Constructs a rewriting system from Congruence::relations and Congruence::extra applied to cong.
Constructs a rewriting system with rules corresponding to the relations used to define cong, i.e. Congruence::relations and Congruence::extra, and with the SHORTLEX reduction ordering.
| libsemigroups::RWS::~RWS | ( | ) |
A default destructor.
This deletes the reduction order used to construct the object, and the rules in the system.
| void libsemigroups::RWS::add_rule | ( | rws_word_t * | p, |
| rws_word_t * | q | ||
| ) |
Add a rule to the rewriting system.
The parameters p and q correspond to the rule being added.
If p and q are not equal, then this method adds a rule to the rewriting system, where the left-hand side of the rule is strictly greater than the right-hand side in the reduction ordering used to defined this. If p and q are equal, then the rewriting system is unchanged and p and q are deleted.
The parameters p and q are not copied and will be deleted by the this.
| void libsemigroups::RWS::add_rule | ( | rws_word_t const & | p, |
| rws_word_t const & | q | ||
| ) |
Add a rule to the rewriting system.
The principal difference between this method and RWS::add_rule(rws_word_t* p, rws_word_t* q) is that the arguments are copied by this method.
|
inline |
Adds rules derived from relations via RWS::word_to_rws_word to the rewriting system.
|
inline |
Add rules derived from Congruence::relations and Congruence::extra applied to cong.
|
inline |
Returns true if the rewriting system is confluent and false if it is not.
|
inline |
Run the Knuth-Bendix algorithm on the rewriting system.
| void libsemigroups::RWS::knuth_bendix | ( | std::atomic< bool > & | killed | ) |
Run the Knuth-Bendix algorithm on the rewriting system until it terminates or killed is set to true.
|
static |
Helper function for converting a libsemigroups::letter_t to a libsemigroups::rws_letter_t.
|
static |
Helper function for converting a libsemigroups::letter_t to a libsemigroups::rws_word_t.
|
inline |
Returns the current number of active rules in the rewriting system.
| void libsemigroups::RWS::rewrite | ( | rws_word_t * | w | ) | const |
Rewrites the word pointed to by w in-place according to the current rules in the rewriting system.
|
inline |
Rewrites a copy of the word w according to the current rules in the rewriting system.
|
inline |
Returns an iterator pointing at the first Rule of this.
|
inline |
Returns an iterator pointing past the last Rule of this.
|
static |
Helper function for converting a libsemigroups::rws_letter_t to a libsemigroups::letter_t.
|
static |
Helper function for converting a libsemigroups::rws_word_t to a libsemigroups::word_t.
|
inline |
If you somehow magically know that the rewriting system is confluent, or not, then you can set this using this method.
|
inline |
Turn reporting on or off.
If val is true, then some methods for a RWS object may report information about the progress of the computation.
Returns true if the reduced form of RWS::word_to_rws_word(p) equal the reduced form of RWS::word_to_rws_word(q), and false if not.
| bool libsemigroups::RWS::test_equals | ( | rws_word_t const & | p, |
| rws_word_t const & | q | ||
| ) |
Returns true if RWS::rewrite(p) equals RWS::rewrite(q), and false if not.
Returns true if the reduced form of RWS::word_to_rws_word(p) is less than the reduced form of RWS::word_to_rws_word(q), with respect to the reduction ordering of this, and false if not.
| bool libsemigroups::RWS::test_less_than | ( | rws_word_t const & | p, |
| rws_word_t const & | q | ||
| ) |
Returns true if RWS::rewrite(p) is less than RWS::rewrite(q), with respect to the reduction ordering of this, and false if not.
|
static |
Helper function for converting a libsemigroups::word_t to a libsemigroups::rws_word_t.
1.8.13