23#ifndef LIBSEMIGROUPS_DETAIL_KE_HPP_
24#define LIBSEMIGROUPS_DETAIL_KE_HPP_
31#include "libsemigroups/adapters.hpp"
32#include "libsemigroups/constants.hpp"
33#include "libsemigroups/froidure-pin.hpp"
34#include "libsemigroups/kambites-class.hpp"
35#include "libsemigroups/order.hpp"
36#include "libsemigroups/presentation.hpp"
37#include "libsemigroups/types.hpp"
38#include "libsemigroups/word-range.hpp"
44 template <
typename Word>
55 KE(KE
const&) =
default;
57 KE& operator=(KE
const&) =
default;
58 KE& operator=(KE&&) =
default;
61 KE(Kambites<Word>& k, value_type
const& w) : _value() {
69 : KE(k, value_type({k.presentation().letter_no_checks(a)})) {}
71 bool operator==(KE
const& that)
const {
72 return that._value == this->_value;
75 bool operator<(KE
const& that)
const {
83 value_type
const& value() const noexcept {
87 word_type to_word(Kambites<Word>
const& k)
const {
88 v4::ToWord<std::string> to_word(k.presentation().alphabet());
89 return to_word(_value);
92 template <
typename SFINAE = std::
string>
93 auto to_string() const noexcept
94 -> std::enable_if_t<!std::is_same_v<Word,
word_type>, SFINAE> {
105 static_assert(!std::is_trivial<KE<std::string>>::value,
106 "KE is not trivial!!!");
108 std::integral_constant<bool, (
sizeof(KE<std::string>) <= 32)>::value,
109 "KE's sizeof exceeds 32!!");
113 template <
typename Word>
114 struct FroidurePinState<detail::KE<Word>> {
115 using type = Kambites<Word>;
122 template <
typename Word>
124 constexpr size_t operator()(detail::KE<Word>
const&)
const noexcept {
129 template <
typename Word>
130 struct Degree<detail::KE<Word>> {
131 constexpr size_t operator()(detail::KE<Word>
const&)
const noexcept {
136 template <
typename Word>
138 void operator()(detail::KE<Word>
const&,
size_t)
const noexcept {}
141 template <
typename Word>
142 struct One<detail::KE<Word>> {
143 detail::KE<Word> operator()(detail::KE<Word>
const&) {
144 return detail::KE<Word>();
147 detail::KE<Word> operator()(
size_t = 0)
const {
148 return detail::KE<Word>();
152 template <
typename Word>
153 struct Product<detail::KE<Word>> {
154 void operator()(detail::KE<Word>& xy,
155 detail::KE<Word>
const& x,
156 detail::KE<Word>
const& y,
159 using value_type =
typename detail::KE<Word>::value_type;
160 using words::operator+=;
161 value_type w(x.value());
163 xy = detail::KE<Word>(*k, w);
167#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
191 Kambites<std::string>>>::is_finite()
const;
195 detail::KE<detail::MultiView<std::string>>,
197 Kambites<detail::MultiView<std::string>>>>::is_finite()
203 Kambites<word_type>>>::is_finite()
const;
231 template <
typename Word>
232 struct hash<libsemigroups::detail::KE<Word>> {
233 size_t operator()(libsemigroups::detail::KE<Word>
const& x)
const {
234 using value_type =
typename libsemigroups::detail::KE<Word>::value_type;
239 template <
typename Word>
240 struct equal_to<libsemigroups::detail::KE<Word>> {
241 bool operator()(libsemigroups::detail::KE<Word>
const& x,
242 libsemigroups::detail::KE<Word>
const& y)
const {
T back_inserter(T... args)
Class implementing the Froidure-Pin algorithm.
Definition froidure-pin.hpp:188
LimitMax const LIMIT_MAX
Value for the maximum of something.
Kambites(congruence_kind, Presentation< Word > const &) -> Kambites< Word >
Deduction guide.
std::conditional_t< std::is_same_v< Word, detail::MultiView< std::string > >, std::string, Word > native_word_type
Type of the words in the relations of the presentation stored in a Kambites instance.
Definition kambites-class.hpp:164
bool shortlex_compare(T const &first1, T const &last1, T const &first2, T const &last2)
Compare two objects of the same type using the short-lex reduction ordering.
Definition order.hpp:273
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition types.hpp:99
size_t letter_type
Type for the index of a generator of a semigroup.
Definition types.hpp:96
tril
Enum to indicate true, false or not currently knowable.
Definition types.hpp:54
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
Adapter for the complexity of multiplication.
Definition adapters.hpp:121
Adapter for the degree of an element.
Definition adapters.hpp:159
Traits class for FroidurePin.
Definition froidure-pin.hpp:68
Adapter for increasing the degree of an element.
Definition adapters.hpp:199
Adapter for the identity element of the given type.
Definition adapters.hpp:246
Adapter for the product of two elements.
Definition adapters.hpp:284