congruence::KnuthBendix

class KnuthBendix : public libsemigroups::CongruenceInterface

Defined in knuth-bendix.hpp.

On this page we describe the functionality relating to the Knuth-Bendix algorithm for computing congruences of semigroups and monoids.

This page contains details of the member functions of the class libsemigroups::congruence::KnuthBendix.

See

libsemigroups::fpsemigroup::KnuthBendix.

Example

KnuthBendix kb;
kb.set_nr_generators(2);
kb.add_pair({0, 0, 0}, {0});
kb.add_pair({0}, {1, 1});

kb.nr_classes();                            // 5
kb.word_to_class_index({0, 0, 1});          // 4
kb.word_to_class_index({0, 0, 0, 0, 1});    // 4
kb.word_to_class_index({0, 1, 1, 0, 0, 1}); // 4
kb.word_to_class_index({0, 0, 0});          // 0
kb.word_to_class_index({1});                // 1
kb.word_to_class_index({0, 0, 0, 0});       // 2