libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches

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.

See also
Sims2 for equivalent functionality for 2-sided congruences.
SimsSettings for the various things that can be set in a Sims1 object.

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.
 
Sims1init ()
 Reinitialize an existing Sims1 object.
 
Sims1init (Presentation< word_type > const &&p)
 Reinitialize an existing Sims1 object.
 
Sims1init (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.
 
Sims1operator= (Sims1 &&)=default
 Default move assignment operator.
 
Sims1operator= (Sims1 const &)=default
 Default copy assignment operator.
 

Constructor & Destructor Documentation

◆ Sims1() [1/2]

Sims1 ( Presentation< word_type > const & p)
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.

Parameters
pthe presentation.
Exceptions
LibsemigroupsExceptionif p is not valid.
LibsemigroupsExceptionif p has 0-generators and 0-relations.
Libsemigroupsif the alphabet of p is not normalized.
See also
presentation
init

◆ Sims1() [2/2]

Sims1 ( Presentation< word_type > const && p)
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.

Parameters
pthe presentation.
Exceptions
LibsemigroupsExceptionif p is not valid.
LibsemigroupsExceptionif p has 0-generators and 0-relations.
Libsemigroupsif the alphabet of p is not normalized.
See also
presentation
init

Member Function Documentation

◆ cbegin()

iterator cbegin ( size_type n) const
nodiscard

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.

Parameters
nthe maximum number of classes in a congruence.
Returns
An iterator it of type iterator pointing to an WordGraph with at most n or n + 1 nodes.
Exceptions
LibsemigroupsExceptionif n is 0.
LibsemigroupsExceptionif presentation() has 0-generators and 0-relations (i.e. it has not been initialised).
Warning
Copying iterators of this type is expensive. As a consequence, prefix incrementing ++it the returned iterator it significantly cheaper than postfix incrementing it++.
See also
cend

◆ cend()

iterator cend ( size_type n) const
nodiscard

Returns a forward iterator pointing to the empty WordGraph. If incremented, the returned iterator remains valid and continues to point at the empty WordGraph.

Parameters
nthe maximum number of classes in a congruence.
Returns
An iterator it of type iterator pointing to an WordGraph with at most 0 nodes.
Exceptions
LibsemigroupsExceptionif n is 0.
LibsemigroupsExceptionif presentation() has 0-generators and 0-relations (i.e. it has not been initialised).
Warning
Copying iterators of this type is expensive. As a consequence, prefix incrementing ++it the returned iterator it significantly cheaper than postfix incrementing it++.
See also
cbegin

◆ find_if()

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:

  • provide some feedback on the progress of the computation if it runs for more than 1 second.
  • allow for the computation of std::find_if(begin(n), end(n), pred) to be performed using number_of_threads in parallel.
Parameters
nthe maximum number of congruence classes.
predthe predicate applied to every congruence found.
Returns
The first WordGraph for which pred returns true.
Exceptions
LibsemigroupsExceptionif n is 0.
LibsemigroupsExceptionif presentation() has 0-generators and 0-relations (i.e. it has not been initialised).
See also
cbegin

◆ for_each()

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:

  • provide some feedback on the progress of the computation if it runs for more than 1 second.
  • allow for the computation of std::for_each(begin(n), end(n), pred) to be performed using number_of_threads in parallel.
Parameters
nthe maximum number of congruence classes.
predthe predicate applied to every congruence found.
Exceptions
LibsemigroupsExceptionif n is 0.
LibsemigroupsExceptionif presentation() has 0-generators and 0-relations (i.e. it has not been initialised).
See also
cbegin

◆ init() [1/3]

Sims1 & init ( )

This function puts a Sims1 object back into the same state as if it had been newly default constructed.

Returns
A reference to this.
Exceptions
This function guarantees not to throw a LibsemigroupsException.

◆ init() [2/3]

Sims1 & init ( Presentation< word_type > const && p)
inline

This function puts an object back into the same state as if it had been newly constructed from the presentation p.

Parameters
pthe presentation.
Returns
A reference to *this.
Exceptions
LibsemigroupsExceptionif p is not valid
LibsemigroupsExceptionif p has 0-generators and 0-relations.
Libsemigroupsif the alphabet of p is not normalized.
Warning
This function has no exception guarantee, the object will be in the same state as if it was default constructed if an exception is thrown.
See also
presentation(Presentation<word_type> const&)

◆ init() [3/3]

Sims1 & init ( Presentation< word_type > const & p)
inline

This function puts an object back into the same state as if it had been newly constructed from the presentation p.

Parameters
pthe presentation.
Returns
A reference to *this.
Exceptions
LibsemigroupsExceptionif p is not valid
LibsemigroupsExceptionif p has 0-generators and 0-relations.
Libsemigroupsif the alphabet of p is not normalized.
Warning
This function has no exception guarantee, the object will be in the same state as if it was default constructed if an exception is thrown.
See also
presentation(Presentation<word_type> const&)

◆ number_of_congruences()

uint64_t number_of_congruences ( size_t n)

This function is similar to std::distance(begin(n), end(n)) and exists to:

  • provide some feedback on the progress of the computation if it runs for more than 1 second.
  • allow for the computation of std::distance(begin(n), end(n)) to be performed using number_of_threads in parallel.
Parameters
nthe maximum number of congruence classes.
Returns
A value of type uint64_t.
Exceptions
LibsemigroupsExceptionif n is 0.
LibsemigroupsExceptionif presentation() has 0-generators and 0-relations (i.e. it has not been initialised).

The documentation for this class was generated from the following file: