46#ifndef LIBSEMIGROUPS_SIMS_HPP_
47#define LIBSEMIGROUPS_SIMS_HPP_
65#include "constants.hpp"
68#include "exception.hpp"
70#include "knuth-bendix.hpp"
72#include "presentation.hpp"
75#include "todd-coxeter.hpp"
77#include "word-graph.hpp"
79#include "detail/felsch-graph.hpp"
80#include "detail/fmt.hpp"
81#include "detail/iterator.hpp"
82#include "detail/path-iterators.hpp"
83#include "detail/report.hpp"
84#include "detail/rewriters.hpp"
85#include "detail/word-graph-with-sources.hpp"
290 template <
typename Sub
class>
313 size_t _exclude_pruner_index;
314 size_t _idle_thread_restarts;
408 template <
typename OtherSub
class>
414 template <
typename OtherSub
class>
516 return _presentation;
581 LIBSEMIGROUPS_ASSERT(_presentation.rules.cbegin() <= _longs_begin);
582 LIBSEMIGROUPS_ASSERT(_longs_begin <= _presentation.rules.cend());
598 return std::distance(_longs_begin, _presentation.rules.cend()) / 2;
655 template <
typename Func>
657 _pruners.emplace_back(func);
660 return static_cast<Subclass&
>(*this);
702 template <
typename Iterator1,
710 return include_exclude_no_checks(first1, last1, first2, last2, _include);
723 template <
typename Iterator1,
731 return include_exclude(first1, last1, first2, last2, _include);
742 return static_cast<Subclass&
>(*this);
776 template <
typename Iterator1,
784 add_exclude_pruner();
785 return include_exclude_no_checks(first1, last1, first2, last2, _exclude);
798 template <
typename Iterator1,
806 add_exclude_pruner();
807 return include_exclude(first1, last1, first2, last2, _exclude);
846 return _idle_thread_restarts;
883 template <
typename Iterator1,
typename Iterator2>
885 Iterator2 last)
const {
886 presentation().throw_if_letter_not_in_alphabet(first, last);
890 Subclass
const& stats_copy_from(
SimsStats const& stts)
const {
892 return static_cast<Subclass const&
>(*this);
896 template <
typename Iterator1,
901 include_exclude_no_checks(Iterator1 first1,
908 return static_cast<Subclass&
>(*this);
911 template <
typename Iterator1,
915 Subclass& include_exclude(Iterator1 first1,
919 std::vector<word_type>& include_or_exclude) {
922 return static_cast<Subclass&
>(*this).include_exclude_no_checks(
923 first1, last1, first2, last2, include_or_exclude);
926 size_t add_exclude_pruner();
953 template <
typename Sub
class,
typename Word>
957 return sims.add_included_pair_no_checks(
958 u.cbegin(), u.cend(), v.cbegin(), v.cend());
967 template <
typename Sub
class,
typename Int>
971 static_assert(std::is_integral_v<Int>);
982 template <
typename Sub
class>
986 return sims.add_included_pair_no_checks(
998 template <
typename Sub
class>
1001 std::string_view v) {
1002 return sims.add_included_pair_no_checks(
1024 template <
typename Sub
class,
typename Word>
1028 return sims.add_included_pair(u.cbegin(), u.cend(), v.cbegin(), v.cend());
1037 template <
typename Sub
class,
typename Int>
1041 static_assert(std::is_integral_v<Int>);
1051 template <
typename Sub
class>
1055 return sims.add_included_pair(
1067 template <
typename Sub
class>
1070 std::string_view v) {
1071 return sims.add_included_pair(
1092 template <
typename Sub
class,
typename Word>
1096 return sims.add_excluded_pair_no_checks(
1097 u.cbegin(), u.cend(), v.cbegin(), v.cend());
1106 template <
typename Sub
class,
typename Int>
1110 static_assert(std::is_integral_v<Int>);
1121 template <
typename Sub
class>
1125 return sims.add_excluded_pair_no_checks(
1137 template <
typename Sub
class>
1140 std::string_view v) {
1141 return sims.add_excluded_pair_no_checks(
1163 template <
typename Sub
class,
typename Word>
1167 return sims.add_excluded_pair(u.cbegin(), u.cend(), v.cbegin(), v.cend());
1176 template <
typename Sub
class,
typename Int>
1180 static_assert(std::is_integral_v<Int>);
1190 template <
typename Sub
class>
1194 return sims.add_excluded_pair(
1206 template <
typename Sub
class>
1209 std::string_view v) {
1210 return sims.add_excluded_pair(
1224 template <
typename Sims1or2>
1225 class SimsBase :
public SimsSettings<Sims1or2>,
public Reporter {
1226 static_assert(std::is_same_v<Sims1or2, Sims1>
1227 || std::is_same_v<Sims1or2, Sims2>);
1237 using node_type =
typename word_graph_type::node_type;
1240 using label_type =
typename word_graph_type::label_type;
1243 using size_type =
typename word_graph_type::size_type;
1246 using letter_type =
typename word_type::value_type;
1256 class IteratorBase {
1258 using const_reference = word_graph_type
const&;
1259 using const_pointer = word_graph_type
const*;
1260 using sims_type = Sims1or2;
1263 size_type _max_num_classes;
1264 size_type _min_target_node;
1267 using PendingDef =
typename Sims1or2::PendingDef;
1279 Sims1or2
const* _sims1or2;
1283 void init(size_type n);
1287 void partial_copy_for_steal_from(IteratorBase
const& that) {
1288 _felsch_graph = that._felsch_graph;
1293 [[nodiscard]]
bool try_pop(PendingDef& pd);
1297 bool try_define(PendingDef
const& current);
1303 bool install_descendents(PendingDef
const& current);
1305 IteratorBase(Sims1or2
const* s, size_type n);
1311 IteratorBase(IteratorBase
const& that);
1312 IteratorBase(IteratorBase&& that);
1313 IteratorBase& operator=(IteratorBase
const& that);
1314 IteratorBase& operator=(IteratorBase&& that);
1317 [[nodiscard]]
bool operator==(IteratorBase
const& that)
const noexcept {
1318 return _felsch_graph == that._felsch_graph;
1321 [[nodiscard]]
bool operator!=(IteratorBase
const& that)
const noexcept {
1322 return !(operator==(that));
1325 [[nodiscard]] const_reference operator*() const noexcept {
1326 return _felsch_graph;
1329 [[nodiscard]] const_pointer operator->() const noexcept {
1330 return &_felsch_graph;
1333 void swap(IteratorBase& that)
noexcept;
1335 SimsStats& stats() noexcept {
1336 return _sims1or2->stats();
1339 size_type maximum_number_of_classes() const noexcept {
1340 return _max_num_classes;
1343 Sims1or2
const& sims() const noexcept {
1359 class iterator :
public Sims1or2::iterator_base {
1360 using iterator_base =
typename Sims1or2::iterator_base;
1361 using PendingDef =
typename Sims1or2::PendingDef;
1363 using iterator_base::init;
1364 using iterator_base::install_descendents;
1365 using iterator_base::try_define;
1366 using iterator_base::try_pop;
1370 using const_pointer =
typename iterator_base::const_pointer;
1372 using const_reference =
typename iterator_base::const_reference;
1374 using size_type =
typename std::vector<word_graph_type>::size_type;
1376 using difference_type =
1377 typename std::vector<word_graph_type>::difference_type;
1379 using pointer =
typename std::vector<word_graph_type>::pointer;
1381 using reference =
typename std::vector<word_graph_type>::reference;
1383 using value_type = word_graph_type;
1385 using iterator_category = std::forward_iterator_tag;
1388 using sims_type =
typename iterator_base::sims_type;
1391 using iterator_base::iterator_base;
1395 iterator(Sims1or2
const* s, size_type n);
1398 friend iterator SimsBase::cbegin(SimsBase::size_type)
const;
1399 friend iterator SimsBase::cend(SimsBase::size_type)
const;
1405 iterator() : iterator_base() {}
1408 iterator(iterator
const& that) : iterator_base(that) {}
1411 iterator(iterator&& that) : iterator_base(std::
move(that)) {}
1414 iterator& operator=(iterator
const& that) {
1416 iterator_base::operator=(that);
1421 iterator& operator=(iterator&& that) {
1422 iterator_base::operator=(
std::move(that));
1428 iterator
const& operator++();
1432 iterator operator++(
int) {
1433 return detail::default_postfix_increment(*
this);
1436 using iterator_base::swap;
1440 class thread_runner;
1441 class thread_iterator;
1443 void report_at_start(
size_t num_classes)
const;
1444 void report_progress_from_thread()
const;
1445 void report_final()
const;
1447 void throw_if_not_ready(size_type n)
const;
1451 SimsBase(SimsBase
const& other) =
default;
1452 SimsBase(SimsBase&&) =
default;
1453 SimsBase& operator=(SimsBase
const&) =
default;
1454 SimsBase& operator=(SimsBase&&) =
default;
1467 [[nodiscard]] iterator cbegin(size_type n)
const {
1468 throw_if_not_ready(n);
1469 return iterator(
static_cast<Sims1or2 const*
>(
this), n);
1472 [[nodiscard]] iterator cend(size_type n)
const {
1473 throw_if_not_ready(n);
1474 return iterator(
static_cast<Sims1or2 const*
>(
this), 0);
1479 void for_each(size_type n,
1480 std::function<
void(word_graph_type
const&)> pred)
const;
1483 find_if(size_type n,
1484 std::function<
bool(word_graph_type
const&)> pred)
const;
1486 uint64_t number_of_congruences(size_type n)
const;
1520 class Sims1 :
public detail::SimsBase<Sims1> {
1522 using SimsBase = detail::SimsBase<Sims1>;
1523 using iterator_base = IteratorBase;
1559 using felsch_graph_type
1560 = detail::FelschGraph<detail::WordGraphWithSources<uint32_t>,
1638#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1817 class Sims2 :
public detail::SimsBase<Sims2> {
1818 using SimsBase = detail::SimsBase<Sims2>;
1898#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1935 class iterator_base :
public SimsBase::IteratorBase {
1936 class RuleContainer;
1939 using const_reference = SimsBase::IteratorBase::const_reference;
1940 using const_pointer = SimsBase::IteratorBase::const_pointer;
1949 void partial_copy_for_steal_from(iterator_base
const& that);
1953 [[nodiscard]]
bool try_define(PendingDef
const&);
1959 iterator_base(iterator_base
const& that);
1960 iterator_base(iterator_base&& that);
1961 iterator_base&
operator=(iterator_base
const& that);
1962 iterator_base&
operator=(iterator_base&& that);
1966 void swap(iterator_base& that)
noexcept;
2027 template <
typename OtherSub
class>
2046 template <
typename OtherSub
class>
2278 class const_cgp_iterator;
2292 class const_rcgp_iterator {
2349 template <
typename Node>
2350 friend const_rcgp_iterator
2353 template <
typename Node>
2354 friend const_rcgp_iterator
2359 template <
typename Node>
2360 friend const_rcgp_iterator
2363 template <
typename Node>
2364 friend const_rcgp_iterator
2369 template <
typename Node>
2373 template <
typename Node>
2379 template <
typename Node>
2383 template <
typename Node>
2396 const_rcgp_iterator&
operator=(const_rcgp_iterator
const&) =
default;
2398 const_rcgp_iterator&
operator=(const_rcgp_iterator&&) =
default;
2400 ~const_rcgp_iterator();
2405 return _gen == that._gen && _source == that._source;
2420 populate_relation();
2427 populate_relation();
2436 return detail::default_postfix_increment(*
this);
2440 void swap(const_rcgp_iterator& that)
noexcept;
2443 [[nodiscard]]
bool at_end() const noexcept {
2444 return _source == _word_graph->number_of_active_nodes();
2448 bool populate_relation()
const;
2499 using const_rcgp_iterator::const_rcgp_iterator;
2503 using const_rcgp_iterator::operator==;
2504 using const_rcgp_iterator::operator!=;
2505 using const_rcgp_iterator::operator*;
2506 using const_rcgp_iterator::operator->;
2513 return detail::default_postfix_increment(*
this);
2522 bool populate_relation()
const;
2526 template <
typename Node>
2527 rx::iterator_range<const_rcgp_iterator>
2532 template <
typename Node>
2533 rx::iterator_range<const_rcgp_iterator>
2537 template <
typename Node>
2538 rx::iterator_range<const_cgp_iterator>
2543 template <
typename Node>
2544 rx::iterator_range<const_cgp_iterator>
2552 template <
typename Node>
2558 template <
typename Node>
2572 template <
typename Node>
2592 template <
typename Node>
2602 template <
typename Node>
2608 template <
typename Node>
2625 template <
typename Node>
2629 return const_rcgp_iterator(p, &wg, 0, 0);
2641 template <
typename Node>
2670 template <
typename Node>
2693 template <
typename Node>
2713 template <
typename Node>
2717 return const_rcgp_iterator(p, &wg, wg.number_of_active_nodes(), 0);
2729 template <
typename Node>
2756 template <
typename Node>
2779 template <
typename Node>
2798 template <
typename Node>
2799 rx::iterator_range<const_rcgp_iterator>
2815 template <
typename Node>
2816 rx::iterator_range<const_rcgp_iterator>
2834 template <
typename Node>
2835 rx::iterator_range<const_rcgp_iterator>
2851 template <
typename Node>
2852 rx::iterator_range<const_rcgp_iterator>
2874 template <
typename Node>
2875 rx::iterator_range<const_cgp_iterator>
2878 return rx::iterator_range(
2899 template <
typename Node>
2900 rx::iterator_range<const_cgp_iterator>
2925 template <
typename Node>
2926 rx::iterator_range<const_cgp_iterator>
2930 return rx::iterator_range(
2951 template <
typename Node>
2952 rx::iterator_range<const_cgp_iterator>
2966 template <
typename Node>
2986 template <
typename Iterator>
2995 template <
typename Iterator>
3122 using node_type = uint32_t;
3123 using KnuthBendix_ = KnuthBendix<word_type>;
3133 : _default_thread_id(), _knuth_bendices(), _mtx(), _presentation() {
3217 return _presentation;
A representation of a graph in the DOT language of Graphviz.
Definition dot.hpp:115
Class representing a collection of spanning trees of a word graph.
Definition forest.hpp:42
For computing the minimal degree of a transformation representation arising from a right congruences ...
Definition sims.hpp:2184
MinimalRepOrc & target_size(size_t val) noexcept
Set the target size.
Definition sims.hpp:2222
MinimalRepOrc()
Default constructor.
Definition sims.hpp:2192
size_t target_size() const noexcept
Get the current target size.
Definition sims.hpp:2237
Sims1::word_graph_type word_graph() const
Get the word graph.
MinimalRepOrc & init()
Reinitialize an existing MinimalRepOrc object.
Definition sims.hpp:2205
For an implementation of presentations for semigroups or monoids.
Definition presentation.hpp:103
word_type const & alphabet() const noexcept
Return the alphabet of the presentation.
Definition presentation.hpp:184
For computing small degree transformation representations of a finite semigroup or monoid.
Definition sims.hpp:1990
RepOrc & max_nodes(size_t val) noexcept
Set the maximum number of nodes.
Definition sims.hpp:2092
size_t max_nodes() const noexcept
Get the current maximum number of nodes.
Definition sims.hpp:2106
RepOrc & target_size(size_t val) noexcept
Set the target size.
Definition sims.hpp:2122
RepOrc()
Default constructor.
Definition sims.hpp:1998
size_t min_nodes() const noexcept
Get the current minimum number of nodes.
Definition sims.hpp:2077
size_t target_size() const noexcept
Get the current target size.
Definition sims.hpp:2137
Sims1::word_graph_type word_graph() const
Get the word_graph.
RepOrc & init()
Reinitialize an existing RepOrc object.
RepOrc & min_nodes(size_t val) noexcept
Set the minimum number of nodes.
Definition sims.hpp:2063
RepOrc & init(SimsSettings< OtherSubclass > const &s)
Initialize an existing RepOrc object from Sims1, Sims2 or MinimalRepOrc.
Definition sims.hpp:2047
RepOrc(SimsSettings< OtherSubclass > const &s)
Construct from Sims1, Sims2 or MinimalRepOrc.
Definition sims.hpp:2028
Reporter & init()
Initialize an existing Reporter object.
For computing finite index right congruences of a finitely presented semigroup or monoid.
Definition sims.hpp:1520
word_type::value_type letter_type
Type for letters in the underlying presentation.
Definition sims.hpp:1548
uint64_t number_of_congruences(size_type n) const
Returns the number of one-sided congruences with up to a given number of classes.
Sims1 & operator=(Sims1 const &)=default
Default copy assignment operator.
SimsBase::word_graph_type word_graph_type
The type of the associated WordGraph objects.
Definition sims.hpp:1539
word_graph_type::size_type size_type
The size_type of the associated WordGraph objects.
Definition sims.hpp:1551
word_graph_type::label_type label_type
Type of the edge labels in the associated WordGraph objects.
Definition sims.hpp:1545
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()=default
Default constructor.
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,...
word_graph_type::node_type node_type
Type of the nodes in the associated WordGraph objects.
Definition sims.hpp:1542
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.
Sims1 & init()
Reinitialize an existing Sims1 object.
For computing finite index two-sided congruences of a finitely presented semigroup or monoid.
Definition sims.hpp:1817
Sims2(Presentation< word_type > const &&p)
Construct from a presentation.
Definition sims.hpp:1863
Sims2(Sims2 &&)=default
Default move constructor.
word_type::value_type letter_type
Type for letters in the underlying presentation.
Definition sims.hpp:1833
Sims2(Sims2 const &other)=default
Default copy constructor.
uint64_t number_of_congruences(size_type n) const
Returns the number of one-sided congruences with up to a given number of classes.
SimsBase::word_graph_type word_graph_type
The type of the associated WordGraph objects.
Definition sims.hpp:1824
Sims2()=default
Default constructor.
Sims2 & operator=(Sims2 const &)=default
Default copy assignment operator.
word_graph_type::size_type size_type
The size_type of the associated WordGraph objects.
Definition sims.hpp:1836
word_graph_type::label_type label_type
Type of the edge labels in the associated WordGraph objects.
Definition sims.hpp:1830
Sims2 & init(Presentation< word_type > const &&p)
Reinitialize an existing Sims2 object.
Definition sims.hpp:1892
Sims2 & init()
Reinitialize an existing Sims2 object.
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.
Sims2 & init(Presentation< word_type > const &p)
Reinitialize an existing Sims2 object.
Definition sims.hpp:1885
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,...
Sims2(Presentation< word_type > const &p)
Construct from a presentation.
Definition sims.hpp:1858
word_graph_type::node_type node_type
Type of the nodes in the associated WordGraph objects.
Definition sims.hpp:1827
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.
Sims2 & operator=(Sims2 &&)=default
Default move assignment operator.
For pruning the search tree when looking for congruences arising from right or two-sided congruences ...
Definition sims.hpp:3020
std::vector< word_type > const & forbid() const noexcept
Get the forbidden pairs defining the refiner.
Definition sims.hpp:3094
bool operator()(Sims1::word_graph_type const &wg)
Check if a word graph can be extended to one defining a faithful congruence.
SimsRefinerFaithful & init(std::vector< word_type > const &forbid)
Reinitialize an existing SimsRefinerFaithful object from a set of forbidden pairs.
Definition sims.hpp:3077
SimsRefinerFaithful(std::vector< word_type > const &forbid)
Construct from set of forbidden pairs.
Definition sims.hpp:3062
SimsRefinerFaithful()
Default constructor.
Definition sims.hpp:3026
SimsRefinerFaithful & init()
Reinitialize an existing SimsRefinerFaithful object.
Definition sims.hpp:3034
For pruning the search tree when looking for congruences arising from right or two-sided ideals.
Definition sims.hpp:3120
SimsRefinerIdeals & operator=(SimsRefinerIdeals const &that)
Copy assignment operator.
SimsRefinerIdeals & operator=(SimsRefinerIdeals &&that)
Move assignment operator.
SimsRefinerIdeals & init()
Reinitialize an existing SimsRefinerIdeals object.
SimsRefinerIdeals(Presentation< word_type > const &p)
Construct from presentation.
Presentation< word_type > const & presentation() const noexcept
Get the presentation over which the refiner is defined.
Definition sims.hpp:3216
SimsRefinerIdeals & init(Presentation< word_type > const &p)
Reinitialize an existing SimsRefinerIdeals object from a word_type presentation.
bool operator()(Sims1::word_graph_type const &wg)
Check if a word graph can be extended to one defining a Rees congruence.
SimsRefinerIdeals(SimsRefinerIdeals &&that)
Move constructor.
Definition sims.hpp:3154
SimsRefinerIdeals(SimsRefinerIdeals const &that)
Copy constructor.
Definition sims.hpp:3146
SimsRefinerIdeals()
Default constructor.
Definition sims.hpp:3132
For setting the presentation and various runtime parameters of the Sims low index algorithm.
Definition sims.hpp:291
SimsStats & stats() const noexcept
Get the current stats object.
Definition sims.hpp:830
Subclass & add_excluded_pair(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add an excluded pair via iterators.
Definition sims.hpp:802
Subclass & clear_excluded_pairs()
Clear the set of excluded words.
WordGraph< uint32_t > word_graph_type
The type of the associated WordGraph objects.
Definition sims.hpp:297
SimsSettings & operator=(SimsSettings const &that)
Definition sims.hpp:375
size_t number_of_long_rules() const noexcept
Returns the number of rules marked as long rules.
Definition sims.hpp:597
Subclass & clear_pruners()
Clear the set of pruners.
SimsSettings const & settings() const noexcept
Definition sims.hpp:435
typename word_graph_type::node_type node_type
Type for the nodes in the associated WordGraph objects.
Definition sims.hpp:300
Subclass & cbegin_long_rules(size_t pos)
Set the beginning of the long rules (position).
size_t number_of_threads() const noexcept
Get the number of threads.
Definition sims.hpp:465
Subclass & add_included_pair(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add an included pair via iterators (no checks).
Definition sims.hpp:727
SimsSettings(SimsSettings const &that)
Definition sims.hpp:362
Subclass & idle_thread_restarts(size_t val)
Set the idle thread restart attempt count.
Subclass & long_rule_length(size_t val)
Set the length of a long rule.
typename word_graph_type::label_type label_type
Type for the labels in the associated WordGraph objects.
Definition sims.hpp:303
SimsSettings & operator=(SimsSettings &&that)
Definition sims.hpp:402
SimsSettings(SimsSettings< OtherSubclass > const &that)
Construct from SimsSettings with different subclass.
Definition sims.hpp:409
Subclass & presentation(Presentation< word_type > const &p)
Set the presentation over which the congruences produced by an instance are defined.
Subclass & add_excluded_pair_no_checks(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add an excluded pair via iterators (no checks).
Definition sims.hpp:780
Presentation< word_type > const & presentation() const noexcept
Get the presentation over which the congruences produced by an instance are defined.
Definition sims.hpp:515
Subclass & clear_included_pairs()
Clear the set of included pairs.
Definition sims.hpp:740
SimsSettings(SimsSettings &&that)
Definition sims.hpp:389
std::vector< word_type > const & included_pairs() const noexcept
Get the set of pairs that must be included in every congruence.
Definition sims.hpp:688
void throw_if_letter_not_in_alphabet(Iterator1 first, Iterator2 last) const
Throws if any letter in a range is out of bounds.
Definition sims.hpp:884
size_t idle_thread_restarts() const noexcept
Get the idle thread restart attempt count.
Definition sims.hpp:845
auto const & pruners() const noexcept
Get all active pruners of the search tree.
Definition sims.hpp:640
Subclass & add_included_pair_no_checks(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add an included pair via iterators.
Definition sims.hpp:706
typename word_graph_type::size_type size_type
The size_type of the associated WordGraph objects.
Definition sims.hpp:306
Subclass & init(SimsSettings< OtherSubclass > const &that)
Initialize from SimsSettings with different subclass.
Subclass & cbegin_long_rules(std::vector< word_type >::const_iterator it)
Set the beginning of the long rules (iterator).
Subclass & number_of_threads(size_t val)
Set the number of threads.
typename word_type::value_type letter_type
Type for letters in the underlying presentation.
Definition sims.hpp:309
std::vector< word_type > const & excluded_pairs() const noexcept
Get the set of pairs that must be excluded from every congruence.
Definition sims.hpp:762
Subclass & init()
Reinitialize an existing SimsSettings object.
Subclass & add_pruner(Func &&func)
Add a pruner to the search tree.
Definition sims.hpp:656
Subclass & clear_long_rules()
Clear the set of long rules.
Definition sims.hpp:592
std::vector< word_type >::const_iterator cbegin_long_rules() const noexcept
Get the pointer to the first long rule.
Definition sims.hpp:580
For keeping track of various statistics arising during the runtime of the low index algorithm.
Definition sims.hpp:107
SimsStats & operator=(SimsStats &&that)
Definition sims.hpp:245
std::atomic_uint64_t count_now
Definition sims.hpp:128
SimsStats & operator=(SimsStats const &that)
Definition sims.hpp:217
std::atomic_uint64_t total_pending_last
Definition sims.hpp:153
SimsStats & stats_zero()
Set all statistics to zero.
std::atomic_uint64_t count_last
Definition sims.hpp:119
SimsStats(SimsStats &&that)
Definition sims.hpp:231
SimsStats(SimsStats const &that)
Definition sims.hpp:203
SimsStats & init()
Reinitialize an existing SimsStats object.
Definition sims.hpp:188
SimsStats & stats_check_point()
Store the current statistic values.
Definition sims.hpp:268
SimsStats & init(SimsStats const &that)
Initialize from SimsStats.
std::atomic_uint64_t max_pending
Definition sims.hpp:138
std::atomic_uint64_t total_pending_now
Definition sims.hpp:169
Class for representing word graphs.
Definition word-graph.hpp:83
uint32_t node_type
Definition word-graph.hpp:99
uint32_t label_type
Definition word-graph.hpp:102
size_type out_degree() const noexcept
Returns the out-degree.
Definition word-graph.hpp:842
std::size_t size_type
Definition word-graph.hpp:105
For iterating over the two-sided congruence generating pairs.
Definition sims.hpp:2461
const_cgp_iterator const & operator++()
Prefix increment operator.
relation_type value_type
Type of values pointed to by const_cgp_iterator.
Definition sims.hpp:2482
const_rcgp_iterator::const_pointer const_pointer
Type of const pointers to value_type.
Definition sims.hpp:2470
const_rcgp_iterator::const_reference const_reference
Type of const references to value_type.
Definition sims.hpp:2476
Sims1::word_graph_type word_graph_type
Type of WordGraph.
Definition sims.hpp:2488
std::forward_iterator_tag iterator_category
Iterator category (forward iterator).
Definition sims.hpp:2485
void swap(const_cgp_iterator &that) noexcept
Swap.
Definition sims.hpp:2517
const_rcgp_iterator::pointer pointer
Type of pointers to value_type.
Definition sims.hpp:2473
const_rcgp_iterator()=default
Default constructor.
word_graph_type::label_type label_type
Type of the labels in word_graph_type.
Definition sims.hpp:2497
const_rcgp_iterator::difference_type difference_type
Difference type for const_cgp_iterator.
Definition sims.hpp:2467
const_cgp_iterator operator++(int) noexcept
Postfix increment operator.
Definition sims.hpp:2512
const_rcgp_iterator::reference reference
Type of references to value_type.
Definition sims.hpp:2479
word_graph_type::node_type node_type
Type of the nodes in word_graph_type.
Definition sims.hpp:2494
Sims1::felsch_graph_type felsch_graph_type
Type of FelschGraph.
Definition sims.hpp:2491
const_rcgp_iterator::size_type size_type
Size type for const_cgp_iterator.
Definition sims.hpp:2464
For iterating over the right congruence generating pairs.
Definition sims.hpp:2292
const_pointer operator->() const
Definition sims.hpp:2426
void swap(const_rcgp_iterator &that) noexcept
Swap.
relation_type value_type
Type of values pointed to by const_cgp_iterator.
Definition sims.hpp:2315
const_rcgp_iterator & operator=(const_rcgp_iterator &&)=default
Default move assignment operator.
typename std::vector< relation_type >::const_reference const_reference
Type of const references to value_type.
Definition sims.hpp:2308
const_rcgp_iterator(const_rcgp_iterator &&)=default
Default move constructor.
Sims1::word_graph_type word_graph_type
Type of WordGraph.
Definition sims.hpp:2321
typename std::vector< relation_type >::const_pointer const_pointer
Type of const pointers to value_type.
Definition sims.hpp:2302
std::forward_iterator_tag iterator_category
Iterator category (forward iterator).
Definition sims.hpp:2318
const_rcgp_iterator const & operator++()
Prefix increment operator.
bool operator==(const_rcgp_iterator const &that) const noexcept
Check if both iterators point to the same generating pair.
Definition sims.hpp:2404
const_rcgp_iterator()=default
Default constructor.
word_graph_type::label_type label_type
Type of the labels in word_graph_type.
Definition sims.hpp:2330
typename std::vector< relation_type >::pointer pointer
Type of pointers to value_type.
Definition sims.hpp:2305
typename std::vector< relation_type >::size_type size_type
Size type for const_rcgp_iterator.
Definition sims.hpp:2295
bool operator!=(const_rcgp_iterator const &that) const noexcept
Check if both iterators point to distinct generating pairs.
Definition sims.hpp:2410
const_rcgp_iterator(const_rcgp_iterator const &)=default
Default copy constructor.
typename std::vector< relation_type >::difference_type difference_type
Difference type for const_rcgp_iterator.
Definition sims.hpp:2298
const_rcgp_iterator & operator=(const_rcgp_iterator const &)=default
Default copy assignment operator.
const_reference operator*() const
Return a const reference to the generating pair pointed to by the iterator.
Definition sims.hpp:2419
word_graph_type::node_type node_type
Type of the nodes in word_graph_type.
Definition sims.hpp:2327
typename std::vector< relation_type >::reference reference
Type of references to value_type.
Definition sims.hpp:2312
const_rcgp_iterator operator++(int) noexcept
Postfix increment operator.
Definition sims.hpp:2435
Sims1::felsch_graph_type felsch_graph_type
Type of FelschGraph.
Definition sims.hpp:2324
T emplace_back(T... args)
std::string to_human_readable_repr(Action< Element, Point, Func, Traits, LeftOrRight > const &action)
Return a human readable representation of an Action object.
std::conditional_t< R==0||C==0, DynamicBMat, StaticBMat< R, C > > BMat
Alias template for boolean matrices.
Definition matrix.hpp:3972
std::pair< word_type, word_type > relation_type
Type for a pair of word_type (a relation) of a semigroup.
Definition types.hpp:102
Namespace for Presentation helper functions.
Definition obvinf.hpp:60
void reverse(Presentation< Word > &p)
Reverse every rule.
Definition presentation.hpp:1644
Helper functions for low-index congruences.
Definition sims.hpp:935
bool is_right_congruence_of_dual(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Check if a word graph defines a right congruence on the dual of an f.p. semigroup or monoid.
Definition sims.hpp:2573
bool is_maximal_right_congruence(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Check if a word graph defines a maximal right congruence on an f.p. semigroup or monoid.
bool is_right_congruence(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Check if a word graph defines a right congruence on an f.p. semigroup or monoid.
void throw_if_not_two_sided_congruence(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Throw if a word graph does not define a two sided congruence on a f.p. semigroup or monoid.
const_cgp_iterator cend_two_sided_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to one after the last two-sided congruence generating pair.
Definition sims.hpp:2781
rx::iterator_range< const_cgp_iterator > two_sided_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Compute the two-sided congruence generating pairs of a word graph on an f.p. semigroup or monoid (no ...
Definition sims.hpp:2876
rx::iterator_range< const_cgp_iterator > two_sided_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Range object containing the two-sided congruence generating pairs of a word graph on an f....
Definition sims.hpp:2901
bool is_two_sided_congruence(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Check if a word graph defines a two sided congruence on an f.p. semigroup or monoid.
BMat poset(Iterator first, Iterator last)
Compute the inclusion poset of a collection of congruences defined by word graphs.
const_rcgp_iterator cend_right_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to one after the last right congruence generating pair.
Definition sims.hpp:2731
Subclass & add_included_pair(SimsSettings< Subclass > &sims, Word const &u, Word const &v)
Helper for adding an included pair of words.
Definition sims.hpp:1025
const_rcgp_iterator cbegin_right_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to the first right congruence generating pair.
Definition sims.hpp:2643
const_rcgp_iterator cend_right_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to one after the last right congruence generating pair (no checks).
Definition sims.hpp:2715
rx::iterator_range< const_rcgp_iterator > right_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Compute the right congruence generating pairs of a word graph on an f.p. semigroup or monoid (no chec...
Definition sims.hpp:2800
Subclass & add_excluded_pair(SimsSettings< Subclass > &sims, Word const &u, Word const &v)
Helper for adding an excluded pair of words.
Definition sims.hpp:1164
Dot dot_poset(Iterator first, Iterator last)
Construct a Dot object representing the inclusion poset of a collection of word graphs.
const_cgp_iterator cend_two_sided_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to one after the last two-sided congruence generating pair (no checks).
Definition sims.hpp:2758
Subclass & add_excluded_pair_no_checks(SimsSettings< Subclass > &sims, Word const &u, Word const &v)
Helper for adding an excluded pair of words.
Definition sims.hpp:1093
const_rcgp_iterator cbegin_right_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to the first right congruence generating pair (no checks).
Definition sims.hpp:2627
bool is_two_sided_congruence_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Check if a word graph defines a two-sided congruence on an f.p. semigroup or monoid (no checks).
const_cgp_iterator cbegin_two_sided_generating_pairs_no_checks(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to the first two-sided congruence generating pair (no checks).
Definition sims.hpp:2671
rx::iterator_range< const_rcgp_iterator > right_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Compute the right congruence generating pairs of a word graph on an f.p. semigroup or monoid.
Definition sims.hpp:2817
void throw_if_not_right_congruence(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Throw if a word graph does not define a right congruence on a f.p. semigroup or monoid.
const_cgp_iterator cbegin_two_sided_generating_pairs(Presentation< word_type > const &p, WordGraph< Node > const &wg)
Get an iterator pointing to the first two-sided congruence generating pair.
Definition sims.hpp:2695
Subclass & add_included_pair_no_checks(SimsSettings< Subclass > &sims, Word const &u, Word const &v)
Helper for adding an included pair of words.
Definition sims.hpp:954
Namespace for everything in the libsemigroups library.
Definition action.hpp:44