![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in sims.hpp
.
On this page we describe the functionality relating to the small index congruence algorithm for 1-sided congruences. The algorithm implemented by this class is essentially the low index subgroup algorithm for finitely presented groups described in Section 5.6 of Computation with Finitely Presented Groups by C. Sims; see [54]. The low index subgroups algorithm was adapted for semigroups and monoids by R. Cirpons, J. D. Mitchell, and M. Tsalakou; see [5]
The purpose of this class is to provide the functions cbegin, cend, for_each, and find_if which permit iterating through the one-sided congruences of a semigroup or monoid defined by a presentation containing (a possibly empty) set of pairs and with at most a given number of classes. An iterator returned by cbegin points at an WordGraph instance containing the action of the semigroup or monoid on the classes of a congruence.
Public Types | |
using | label_type = word_graph_type::label_type |
Type of the edge labels in the associated WordGraph objects. | |
using | letter_type = word_type::value_type |
Type for letters in the underlying presentation. | |
using | node_type = word_graph_type::node_type |
Type of the nodes in the associated WordGraph objects. | |
using | size_type = word_graph_type::size_type |
The size_type of the associated WordGraph objects. | |
using | word_graph_type = SimsBase::word_graph_type |
The type of the associated WordGraph objects. | |
Public Member Functions | |
Sims1 ()=default | |
Default constructor. | |
Sims1 (Presentation< word_type > const &&p) | |
Construct from a presentation. | |
Sims1 (Presentation< word_type > const &p) | |
Construct from a presentation. | |
Sims1 (Sims1 &&)=default | |
Default move constructor. | |
Sims1 (Sims1 const &)=default | |
Default copy constructor. | |
iterator | cbegin (size_type n) const |
Returns a forward iterator pointing at the first congruence. | |
iterator | cend (size_type n) const |
Returns a forward iterator pointing one beyond the last congruence. | |
word_graph_type | find_if (size_type n, std::function< bool(word_graph_type const &)> pred) const |
Apply a unary predicate to one-sided congruences with at most a given number of classes, until it returns true . | |
void | for_each (size_type n, std::function< void(word_graph_type const &)> pred) const |
Apply a unary predicate to every one-sided congruence with at most a given number of classes. | |
Sims1 & | init () |
Reinitialize an existing Sims1 object. | |
Sims1 & | init (Presentation< word_type > const &&p) |
Reinitialize an existing Sims1 object. | |
Sims1 & | init (Presentation< word_type > const &p) |
Reinitialize an existing Sims1 object. | |
uint64_t | number_of_congruences (size_t n) |
Returns the number of one-sided congruences with up to a given number of classes. | |
Sims1 & | operator= (Sims1 &&)=default |
Default move assignment operator. | |
Sims1 & | operator= (Sims1 const &)=default |
Default copy assignment operator. | |
|
inlineexplicit |
Constructs an instance from a presentation of word_type.
The rules of the presentation p
are used at every node in the depth first search conducted by an object of this type.
p | the presentation. |
LibsemigroupsException | if p is not valid. |
LibsemigroupsException | if p has 0-generators and 0-relations. |
Libsemigroups | if the alphabet of p is not normalized. |
|
inlineexplicit |
Constructs an instance from a presentation of word_type.
The rules of the presentation p
are used at every node in the depth first search conducted by an object of this type.
p | the presentation. |
LibsemigroupsException | if p is not valid. |
LibsemigroupsException | if p has 0-generators and 0-relations. |
Libsemigroups | if the alphabet of p is not normalized. |
Returns a forward iterator pointing to the WordGraph representing the first congruence described by an object of this type with at most n
classes.
If incremented, the iterator will point to the next such congruence. The order in which the congruences are returned is implementation specific. Iterators of the type returned by this function are equal whenever they point to equal objects. The iterator is exhausted if and only if it points to an WordGraph with zero nodes.
The meaning of the WordGraph pointed at by the returned iterator depends on whether the input is a monoid presentation (i.e. Presentation::contains_empty_word() returns true
) or a semigroup presentation. If the input is a monoid presentation for a monoid \(M\), then the WordGraph pointed to by an iterator of this type has precisely n
nodes, and the right action of \(M\) on the nodes of the word graph is isomorphic to the action of \(M\) on the classes of a right congruence.
If the input is a semigroup presentation for a semigroup \(S\), then the WordGraph has n
+ 1 nodes, and the right action of \(S\) on the nodes \(\{1, \ldots, n\}\) of the WordGraph is isomorphic to the action of \(S\) on the classes of a right congruence. It'd probably be better in this case if node \(0\) was not included in the output WordGraph, but it is required in the implementation of the low-index congruence algorithm, and to avoid unnecessary copies, we've left it in for the time being.
n | the maximum number of classes in a congruence. |
it
of type iterator
pointing to an WordGraph with at most n
or n
+ 1 nodes.LibsemigroupsException | if n is 0 . |
LibsemigroupsException | if presentation() has 0-generators and 0-relations (i.e. it has not been initialised). |
++it
the returned iterator it
significantly cheaper than postfix incrementing it++
.Returns a forward iterator pointing to the empty WordGraph. If incremented, the returned iterator remains valid and continues to point at the empty WordGraph.
n | the maximum number of classes in a congruence. |
it
of type iterator
pointing to an WordGraph with at most 0
nodes.LibsemigroupsException | if n is 0 . |
LibsemigroupsException | if presentation() has 0-generators and 0-relations (i.e. it has not been initialised). |
++it
the returned iterator it
significantly cheaper than postfix incrementing it++
.word_graph_type find_if | ( | size_type | n, |
std::function< bool(word_graph_type const &)> | pred ) const |
Apply the function pred
to every one-sided congruence with at most n
classes, until it returns true
.
This function is similar to std::find_if(begin(n), end(n), pred)
and exists to:
std::find_if(begin(n), end(n), pred)
to be performed using number_of_threads in parallel.n | the maximum number of congruence classes. |
pred | the predicate applied to every congruence found. |
pred
returns true
.LibsemigroupsException | if n is 0 . |
LibsemigroupsException | if presentation() has 0-generators and 0-relations (i.e. it has not been initialised). |
void for_each | ( | size_type | n, |
std::function< void(word_graph_type const &)> | pred ) const |
Apply the function pred
to every one-sided congruence with at most n
classes
This function is similar to std::for_each(begin(n), end(n), pred)
and exists to:
std::for_each(begin(n), end(n), pred)
to be performed using number_of_threads in parallel.n | the maximum number of congruence classes. |
pred | the predicate applied to every congruence found. |
LibsemigroupsException | if n is 0 . |
LibsemigroupsException | if presentation() has 0-generators and 0-relations (i.e. it has not been initialised). |
Sims1 & init | ( | ) |
This function puts a Sims1 object back into the same state as if it had been newly default constructed.
this
.
|
inline |
This function puts an object back into the same state as if it had been newly constructed from the presentation p
.
p | the presentation. |
*this
.LibsemigroupsException | if p is not valid |
LibsemigroupsException | if p has 0-generators and 0-relations. |
Libsemigroups | if the alphabet of p is not normalized. |
|
inline |
This function puts an object back into the same state as if it had been newly constructed from the presentation p
.
p | the presentation. |
*this
.LibsemigroupsException | if p is not valid |
LibsemigroupsException | if p has 0-generators and 0-relations. |
Libsemigroups | if the alphabet of p is not normalized. |
uint64_t number_of_congruences | ( | size_t | n | ) |
This function is similar to std::distance(begin(n), end(n))
and exists to:
std::distance(begin(n), end(n))
to be performed using number_of_threads in parallel.n | the maximum number of congruence classes. |
uint64_t
.LibsemigroupsException | if n is 0 . |
LibsemigroupsException | if presentation() has 0-generators and 0-relations (i.e. it has not been initialised). |