Congruence¶

class Congruence : public libsemigroups::CongruenceInterface¶
Defined in
cong.hpp
.On this page we describe the functionality relating to the Congruence class. This class can be used for computing a congruence over a semigroup by running every applicable algorithm from
libsemigroups
(and some variants of the same algorithm) in parallel. This class is provided for convenience, at present it is not very customisable, and lacks some of the fine grained control offered by the classes implementing individual algorithms, such as congruence::ToddCoxeter and congruence::KnuthBendix.See also
congruence_kind and tril.
 Example
FpSemigroup S; S.set_alphabet(3); S.set_identity(0); S.add_rule({1, 2}, {0}); S.is_obviously_infinite(); // false Congruence cong(twosided, S); cong.add_pair({1, 1, 1}, {0}); cong.number_of_classes(); // 3
Member types¶
Type for indices of congruence class indices. 

Type for a 

Type for a 

Type for nontrivial classes. 

Holds values of various options. 

Holds options for specifying the algorithms to be used. 
Constructors¶
Construct from kind (left/right/2sided) and 

Construct from kind (left/right/2sided) and 

Construct from kind (left/right/2sided) and options. 


Construct from kind (left/right/2sided) and shared pointer to 
Deleted constructors¶
Deleted. 

Deleted. 

Deleted. 

Deleted. 

Deleted. 
Member functions¶
Adds a class derived from 

Checks if a Kambites instance is being used to compute the congruence. 

Checks if a KnuthBendix instance is being used to compute the congruence. 

Checks if a ToddCoxeter instance is being used to compute the congruence. 

Returns the Kambites instance used to compute the congruence (if any). 

Returns the KnuthBendix instance used to compute the congruence (if any). 

Get the current maximum number of threads. 

Set the maximum number of threads. 

Returns the ToddCoxeter instance used to compute the congruence (if any). 
Member functions inherited from CongruenceInterface¶

Add a generating pair to the congruence. 
Add a generating pair to the congruence. 

Returns a const iterator pointing to the first generating pair. 

Returns a const iterator pointing to the first nonsingleton class. 

Returns a const iterator pointing oneaftertheend of the last generating pair. 

Returns a const iterator pointing onepasttheend of the last nonsingleton class. 

Get a canonical representative of the 


Check if a pair of words is known to belong to the congruence. 
Check if a pair of words belongs to the congruence. 

Check if the congruence was constructed from a 

Check if the congruence was constructed from a 

Check if the quotient semigroup has been computed. 

Deterministically check if the quotient is finite. 

Deterministically check if the quotient is infinite. 

The handedness of the congruence (left, right, or 2sided). 

Compare the indices of the classes containing two words. 

Returns a shared pointer to the nontrivial classes. 

Compute the number of classes in the congruence. 

The number of generating pairs. 

The number of generators. 

The number of nonsingleton classes. 

Get the parent 

Get the parent 

Returns a semigroup represented as an instance of a derived class of 

Set the number of generators of the congruence. 

Convert a word into the index of the class containing it. 
Member functions inherited from Runner¶
Check if the runner is dead. 

Check if 

Stop 

Check if it is time to report. 

Get the minimum elapsed time between reports. 

Set the minimum elapsed time between reports. 

Set the minimum elapsed time between reports. 

Report why 

Run until 

Run for a specified amount of time. 

Run for a specified amount of time. 

Run until a nullary predicate returns 

Run until a nullary predicate returns 

Check if currently running. 

Check if the runner is currently running for a particular length of time. 

Check if the runner is currently running until a nullary predicate returns 

Check if 

Check if the runner is stopped. 

Check if the runner was, or should, stop because of the argument for 

Check if the amount of time passed to 