21#ifndef LIBSEMIGROUPS_DETAIL_CONG_COMMON_CLASS_HPP_
22#define LIBSEMIGROUPS_DETAIL_CONG_COMMON_CLASS_HPP_
28#include "libsemigroups/debug.hpp"
29#include "libsemigroups/exception.hpp"
30#include "libsemigroups/runner.hpp"
31#include "libsemigroups/types.hpp"
36 class CongruenceCommon :
public Runner {
44 std::vector<word_type> _internal_generating_pairs;
54 CongruenceCommon() =
default;
56 CongruenceCommon& init() {
57 _internal_generating_pairs.clear();
72 CongruenceCommon(CongruenceCommon
const&);
73 CongruenceCommon(CongruenceCommon&&);
74 CongruenceCommon& operator=(CongruenceCommon
const&);
75 CongruenceCommon& operator=(CongruenceCommon&&);
81 template <
typename Sub
class,
typename Iterator1,
typename Iterator2>
82 void throw_if_letter_not_in_alphabet(Iterator1 first,
83 Iterator2 last)
const {
84 static_cast<Subclass const*
>(
this)->throw_if_letter_not_in_alphabet(
96 [[nodiscard]]
size_t number_of_generating_pairs() const noexcept {
97 return _internal_generating_pairs.size() / 2;
101 [[nodiscard]] std::vector<word_type>
const&
102 internal_generating_pairs() const noexcept {
103 return _internal_generating_pairs;
125 template <
typename Subclass,
130 Subclass& add_internal_generating_pair_no_checks(Iterator1 first1,
135 template <
typename Subclass,
140 Subclass& add_generating_pair(Iterator1 first1,
151 template <
typename Subclass,
156 [[nodiscard]]
tril currently_contains(Iterator1 first1,
159 Iterator4 last2)
const;
160 template <
typename Subclass,
165 [[nodiscard]]
bool contains_no_checks(Iterator1 first1,
170 template <
typename Subclass,
175 [[nodiscard]]
bool contains(Iterator1 first1,
179 throw_if_letter_not_in_alphabet<Subclass>(first1, last1);
180 throw_if_letter_not_in_alphabet<Subclass>(first2, last2);
181 return contains_no_checks<Subclass>(first1, last1, first2, last2);
190 template <
typename Subclass,
191 typename OutputIterator,
194 OutputIterator reduce_no_run(OutputIterator d_first,
196 Iterator2 last)
const;
198 template <
typename Subclass,
199 typename OutputIterator,
202 OutputIterator reduce_no_checks(OutputIterator d_first,
206 return static_cast<Subclass const&
>(*this).reduce_no_run_no_checks(
207 d_first, first, last);
210 template <
typename Subclass,
211 typename OutputIterator,
212 typename InputIterator1,
213 typename InputIterator2>
214 OutputIterator reduce(OutputIterator d_first,
215 InputIterator1 first,
216 InputIterator2 last);
219 void throw_if_started()
const;
224#include "cong-common-class.tpp"
void run()
Run until finished.
Runner & init()
Initialize an existing Runner object.
tril
Enum to indicate true, false or not currently knowable.
Definition types.hpp:56
congruence_kind
Enum to indicate the sided-ness of a congruence.
Definition types.hpp:69
Namespace for everything in the libsemigroups library.
Definition action.hpp:44