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;
1272 FelschGraph<word_type, node_type, std::vector<Definition>>
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;
1391 using iterator_base::iterator_base;
1398 friend iterator SimsBase::cbegin(SimsBase::size_type)
const;
1399 friend iterator SimsBase::cend(SimsBase::size_type)
const;
1408 iterator(iterator
const& that) : iterator_base(that) {}
1416 iterator_base::operator=(that);
1422 iterator_base::operator=(
std::move(that));
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,
1483 find_if(size_type n,
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<word_type, node_type, std::vector<Definition>>;
1566 using SimsBase::init;
1637#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1816 class Sims2 :
public detail::SimsBase<Sims2> {
1817 using SimsBase = detail::SimsBase<Sims2>;
1837 using SimsBase::init;
1897#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1934 class iterator_base :
public SimsBase::IteratorBase {
1935 class RuleContainer;
1938 using const_reference = SimsBase::IteratorBase::const_reference;
1939 using const_pointer = SimsBase::IteratorBase::const_pointer;
1948 void partial_copy_for_steal_from(iterator_base
const& that);
1952 [[nodiscard]]
bool try_define(PendingDef
const&);
1958 iterator_base(iterator_base
const& that);
1959 iterator_base(iterator_base&& that);
1960 iterator_base&
operator=(iterator_base
const& that);
1961 iterator_base&
operator=(iterator_base&& that);
1965 void swap(iterator_base& that)
noexcept;
2026 template <
typename OtherSub
class>
2045 template <
typename OtherSub
class>
2277 class const_cgp_iterator;
2291 class const_rcgp_iterator {
2348 template <
typename Node>
2349 friend const_rcgp_iterator
2352 template <
typename Node>
2353 friend const_rcgp_iterator
2358 template <
typename Node>
2359 friend const_rcgp_iterator
2362 template <
typename Node>
2363 friend const_rcgp_iterator
2368 template <
typename Node>
2372 template <
typename Node>
2378 template <
typename Node>
2382 template <
typename Node>
2395 const_rcgp_iterator&
operator=(const_rcgp_iterator
const&) =
default;
2397 const_rcgp_iterator&
operator=(const_rcgp_iterator&&) =
default;
2399 ~const_rcgp_iterator();
2404 return _gen == that._gen && _source == that._source;
2419 populate_relation();
2426 populate_relation();
2435 return detail::default_postfix_increment(*
this);
2439 void swap(const_rcgp_iterator& that)
noexcept;
2442 [[nodiscard]]
bool at_end() const noexcept {
2443 return _source == _word_graph->number_of_active_nodes();
2447 bool populate_relation()
const;
2498 using const_rcgp_iterator::const_rcgp_iterator;
2502 using const_rcgp_iterator::operator==;
2503 using const_rcgp_iterator::operator!=;
2504 using const_rcgp_iterator::operator*;
2505 using const_rcgp_iterator::operator->;
2512 return detail::default_postfix_increment(*
this);
2521 bool populate_relation()
const;
2525 template <
typename Node>
2526 rx::iterator_range<const_rcgp_iterator>
2531 template <
typename Node>
2532 rx::iterator_range<const_rcgp_iterator>
2536 template <
typename Node>
2537 rx::iterator_range<const_cgp_iterator>
2542 template <
typename Node>
2543 rx::iterator_range<const_cgp_iterator>
2551 template <
typename Node>
2557 template <
typename Node>
2571 template <
typename Node>
2591 template <
typename Node>
2601 template <
typename Node>
2607 template <
typename Node>
2624 template <
typename Node>
2628 return const_rcgp_iterator(p, &wg, 0, 0);
2640 template <
typename Node>
2669 template <
typename Node>
2692 template <
typename Node>
2712 template <
typename Node>
2716 return const_rcgp_iterator(p, &wg, wg.number_of_active_nodes(), 0);
2728 template <
typename Node>
2755 template <
typename Node>
2778 template <
typename Node>
2797 template <
typename Node>
2798 rx::iterator_range<const_rcgp_iterator>
2814 template <
typename Node>
2815 rx::iterator_range<const_rcgp_iterator>
2833 template <
typename Node>
2834 rx::iterator_range<const_rcgp_iterator>
2850 template <
typename Node>
2851 rx::iterator_range<const_rcgp_iterator>
2873 template <
typename Node>
2874 rx::iterator_range<const_cgp_iterator>
2877 return rx::iterator_range(
2898 template <
typename Node>
2899 rx::iterator_range<const_cgp_iterator>
2924 template <
typename Node>
2925 rx::iterator_range<const_cgp_iterator>
2929 return rx::iterator_range(
2950 template <
typename Node>
2951 rx::iterator_range<const_cgp_iterator>
2965 template <
typename Node>
2985 template <
typename Iterator>
2994 template <
typename Iterator>
3121 using node_type = uint32_t;
3122 using KnuthBendix_ = KnuthBendix<word_type>;
3130 : _knuth_bendices(
std::thread::hardware_concurrency() + 1,
3144 _presentation.
init();
3145 _knuth_bendices[0].
init();
3147 _knuth_bendices.end(),
3148 _knuth_bendices[0]);
3164 : _knuth_bendices(
std::thread::hardware_concurrency() + 1,
3209 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:2183
MinimalRepOrc & target_size(size_t val) noexcept
Set the target size.
Definition sims.hpp:2221
MinimalRepOrc()
Default constructor.
Definition sims.hpp:2191
size_t target_size() const noexcept
Get the current target size.
Definition sims.hpp:2236
Sims1::word_graph_type word_graph() const
Get the word graph.
MinimalRepOrc & init()
Reinitialize an existing MinimalRepOrc object.
Definition sims.hpp:2204
For an implementation of presentations for semigroups or monoids.
Definition presentation.hpp:102
word_type const & alphabet() const noexcept
Return the alphabet of the presentation.
Definition presentation.hpp:183
For computing small degree transformation representations of a finite semigroup or monoid.
Definition sims.hpp:1989
RepOrc & max_nodes(size_t val) noexcept
Set the maximum number of nodes.
Definition sims.hpp:2091
size_t max_nodes() const noexcept
Get the current maximum number of nodes.
Definition sims.hpp:2105
RepOrc & target_size(size_t val) noexcept
Set the target size.
Definition sims.hpp:2121
RepOrc()
Default constructor.
Definition sims.hpp:1997
size_t min_nodes() const noexcept
Get the current minimum number of nodes.
Definition sims.hpp:2076
size_t target_size() const noexcept
Get the current target size.
Definition sims.hpp:2136
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:2062
RepOrc & init(SimsSettings< OtherSubclass > const &s)
Initialize an existing RepOrc object from Sims1, Sims2 or MinimalRepOrc.
Definition sims.hpp:2046
RepOrc(SimsSettings< OtherSubclass > const &s)
Construct from Sims1, Sims2 or MinimalRepOrc.
Definition sims.hpp:2027
For computing finite index right congruences of a finitely presented semigroup or monoid.
Definition sims.hpp:1520
uint64_t number_of_congruences(size_t n)
Returns the number of one-sided congruences with up to a given number of classes.
word_type::value_type letter_type
Type for letters in the underlying presentation.
Definition sims.hpp:1548
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:1816
Sims2(Presentation< word_type > const &&p)
Construct from a presentation.
Definition sims.hpp:1862
uint64_t number_of_congruences(size_t n)
Returns the number of one-sided congruences with up to a given number of classes.
Sims2(Sims2 &&)=default
Default move constructor.
word_type::value_type letter_type
Type for letters in the underlying presentation.
Definition sims.hpp:1832
Sims2(Sims2 const &other)=default
Default copy constructor.
SimsBase::word_graph_type word_graph_type
The type of the associated WordGraph objects.
Definition sims.hpp:1823
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:1835
word_graph_type::label_type label_type
Type of the edge labels in the associated WordGraph objects.
Definition sims.hpp:1829
Sims2 & init(Presentation< word_type > const &&p)
Reinitialize an existing Sims2 object.
Definition sims.hpp:1891
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:1884
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:1857
word_graph_type::node_type node_type
Type of the nodes in the associated WordGraph objects.
Definition sims.hpp:1826
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:3019
std::vector< word_type > const & forbid() const noexcept
Get the forbidden pairs defining the refiner.
Definition sims.hpp:3093
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:3076
SimsRefinerFaithful(std::vector< word_type > const &forbid)
Construct from set of forbidden pairs.
Definition sims.hpp:3061
SimsRefinerFaithful()
Default constructor.
Definition sims.hpp:3025
SimsRefinerFaithful & init()
Reinitialize an existing SimsRefinerFaithful object.
Definition sims.hpp:3033
For pruning the search tree when looking for congruences arising from right or two-sided ideals.
Definition sims.hpp:3119
SimsRefinerIdeals & init()
Reinitialize an existing SimsRefinerIdeals object.
Definition sims.hpp:3143
SimsRefinerIdeals(Presentation< word_type > const &p)
Construct from presentation.
Definition sims.hpp:3163
Presentation< word_type > const & presentation() const noexcept
Get the presentation over which the refiner is defined.
Definition sims.hpp:3208
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()
Default constructor.
Definition sims.hpp:3129
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:82
uint32_t node_type
Definition word-graph.hpp:98
uint32_t label_type
Definition word-graph.hpp:101
size_type out_degree() const noexcept
Returns the out-degree.
Definition word-graph.hpp:823
std::size_t size_type
Definition word-graph.hpp:104
typename std::vector< word_graph_type >::pointer pointer
No doc.
Definition sims.hpp:1379
typename std::vector< word_graph_type >::size_type size_type
No doc.
Definition sims.hpp:1374
word_graph_type value_type
No doc.
Definition sims.hpp:1383
iterator(iterator const &that)
No doc.
Definition sims.hpp:1408
typename iterator_base::const_pointer const_pointer
No doc.
Definition sims.hpp:1370
iterator const & operator++()
No doc.
iterator(iterator &&that)
No doc.
Definition sims.hpp:1411
typename std::vector< word_graph_type >::difference_type difference_type
No doc.
Definition sims.hpp:1376
iterator operator++(int)
No doc.
Definition sims.hpp:1432
iterator & operator=(iterator const &that)
No doc.
Definition sims.hpp:1414
iterator()
No doc.
Definition sims.hpp:1405
std::forward_iterator_tag iterator_category
No doc.
Definition sims.hpp:1385
iterator & operator=(iterator &&that)
No doc.
Definition sims.hpp:1421
typename iterator_base::sims_type sims_type
No doc.
Definition sims.hpp:1388
typename iterator_base::const_reference const_reference
No doc.
Definition sims.hpp:1372
typename std::vector< word_graph_type >::reference reference
No doc.
Definition sims.hpp:1381
For iterating over the two-sided congruence generating pairs.
Definition sims.hpp:2460
const_cgp_iterator const & operator++()
Prefix increment operator.
relation_type value_type
Type of values pointed to by const_cgp_iterator.
Definition sims.hpp:2481
const_rcgp_iterator::const_pointer const_pointer
Type of const pointers to value_type.
Definition sims.hpp:2469
const_rcgp_iterator::const_reference const_reference
Type of const references to value_type.
Definition sims.hpp:2475
Sims1::word_graph_type word_graph_type
Type of WordGraph.
Definition sims.hpp:2487
std::forward_iterator_tag iterator_category
Iterator category (forward iterator).
Definition sims.hpp:2484
void swap(const_cgp_iterator &that) noexcept
Swap.
Definition sims.hpp:2516
const_rcgp_iterator::pointer pointer
Type of pointers to value_type.
Definition sims.hpp:2472
const_rcgp_iterator()=default
Default constructor.
word_graph_type::label_type label_type
Type of the labels in word_graph_type.
Definition sims.hpp:2496
const_rcgp_iterator::difference_type difference_type
Difference type for const_cgp_iterator.
Definition sims.hpp:2466
const_cgp_iterator operator++(int) noexcept
Postfix increment operator.
Definition sims.hpp:2511
const_rcgp_iterator::reference reference
Type of references to value_type.
Definition sims.hpp:2478
word_graph_type::node_type node_type
Type of the nodes in word_graph_type.
Definition sims.hpp:2493
Sims1::felsch_graph_type felsch_graph_type
Type of FelschGraph.
Definition sims.hpp:2490
const_rcgp_iterator::size_type size_type
Size type for const_cgp_iterator.
Definition sims.hpp:2463
For iterating over the right congruence generating pairs.
Definition sims.hpp:2291
const_pointer operator->() const
Definition sims.hpp:2425
void swap(const_rcgp_iterator &that) noexcept
Swap.
relation_type value_type
Type of values pointed to by const_cgp_iterator.
Definition sims.hpp:2314
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:2307
const_rcgp_iterator(const_rcgp_iterator &&)=default
Default move constructor.
Sims1::word_graph_type word_graph_type
Type of WordGraph.
Definition sims.hpp:2320
typename std::vector< relation_type >::const_pointer const_pointer
Type of const pointers to value_type.
Definition sims.hpp:2301
std::forward_iterator_tag iterator_category
Iterator category (forward iterator).
Definition sims.hpp:2317
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:2403
const_rcgp_iterator()=default
Default constructor.
word_graph_type::label_type label_type
Type of the labels in word_graph_type.
Definition sims.hpp:2329
typename std::vector< relation_type >::pointer pointer
Type of pointers to value_type.
Definition sims.hpp:2304
typename std::vector< relation_type >::size_type size_type
Size type for const_rcgp_iterator.
Definition sims.hpp:2294
bool operator!=(const_rcgp_iterator const &that) const noexcept
Check if both iterators point to distinct generating pairs.
Definition sims.hpp:2409
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:2297
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:2418
word_graph_type::node_type node_type
Type of the nodes in word_graph_type.
Definition sims.hpp:2326
typename std::vector< relation_type >::reference reference
Type of references to value_type.
Definition sims.hpp:2311
const_rcgp_iterator operator++(int) noexcept
Postfix increment operator.
Definition sims.hpp:2434
Sims1::felsch_graph_type felsch_graph_type
Type of FelschGraph.
Definition sims.hpp:2323
T emplace_back(T... args)
std::string to_human_readable_repr(AhoCorasick const &ac)
Return a string representation.
std::conditional_t< R==0||C==0, DynamicBMat, StaticBMat< R, C > > BMat
Alias template for boolean matrices.
Definition matrix.hpp:3963
std::pair< word_type, word_type > relation_type
Type for a pair of word_type (a relation) of a semigroup.
Definition types.hpp:104
Namespace for Presentation helper functions.
Definition obvinf.hpp:59
void reverse(Presentation< Word > &p)
Reverse every rule.
Definition presentation.hpp:1543
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:2572
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:2780
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:2875
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:2900
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:2730
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:2642
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:2714
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:2799
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:2757
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:2626
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:2670
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:2816
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:2694
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