26#ifndef LIBSEMIGROUPS_TODD_COXETER_CLASS_HPP_
27#define LIBSEMIGROUPS_TODD_COXETER_CLASS_HPP_
37#include "presentation.hpp"
40#include "detail/citow.hpp"
41#include "detail/cong-common-class.hpp"
42#include "detail/fmt.hpp"
43#include "detail/todd-coxeter-impl.hpp"
142 template <
typename Word>
143 class ToddCoxeter :
public detail::ToddCoxeterImpl {
145 std::vector<Word> _generating_pairs;
149#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
157 struct options :
public FelschGraphSettings_::options {
377 using node_type =
typename detail::ToddCoxeterImpl::node_type;
402 using index_type =
typename detail::ToddCoxeterImpl::index_type;
410 using label_type =
typename detail::ToddCoxeterImpl::label_type;
534 ToddCoxeterImpl::init(knd, tc);
535 _presentation = tc.presentation();
536 _presentation.rules.insert(_presentation.rules.end(),
537 tc.generating_pairs().cbegin(),
538 tc.generating_pairs().cend());
540 _generating_pairs.clear();
563 template <
typename Node>
585 template <
typename Node>
588#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
592 template <
typename Node>
600 template <
typename Node>
624 template <
typename Iterator1,
typename Iterator2>
626 Iterator2 last)
const {
627 presentation().throw_if_letter_not_in_alphabet(first, last);
644 return _generating_pairs;
664 return _presentation;
688 template <
typename Iterator1,
711 template <
typename Iterator1,
721 return detail::CongruenceCommon::add_generating_pair<ToddCoxeter>(
722 first1, last1, first2, last2);
749 template <
typename Iterator1,
756 Iterator4 last2)
const {
757 return ToddCoxeterImpl::currently_contains_no_checks(
758 detail::citow(
this, first1),
759 detail::citow(
this, last1),
760 detail::citow(
this, first2),
761 detail::citow(
this, last2));
784 template <
typename Iterator1,
791 Iterator4 last2)
const {
794 return detail::CongruenceCommon::currently_contains<ToddCoxeter>(
795 first1, last1, first2, last2);
815 template <
typename Iterator1,
823 return ToddCoxeterImpl::contains_no_checks(detail::citow(
this, first1),
824 detail::citow(
this, last1),
825 detail::citow(
this, first2),
826 detail::citow(
this, last2));
846 template <
typename Iterator1,
880 template <
typename OutputIterator,
881 typename InputIterator1,
882 typename InputIterator2>
884 InputIterator1 first,
885 InputIterator2 last)
const {
886 return ToddCoxeterImpl::reduce_no_run_no_checks(
887 detail::itow(
this, d_first),
888 detail::citow(
this, first),
889 detail::citow(
this, last))
913 template <
typename OutputIterator,
914 typename InputIterator1,
915 typename InputIterator2>
917 InputIterator1 first,
918 InputIterator2 last)
const {
919 return detail::CongruenceCommon::reduce_no_run<ToddCoxeter>(
920 d_first, first, last);
946 template <
typename OutputIterator,
947 typename InputIterator1,
948 typename InputIterator2>
950 InputIterator1 first,
951 InputIterator2 last) {
952 return ToddCoxeterImpl::reduce_no_checks(detail::itow(
this, d_first),
953 detail::citow(
this, first),
954 detail::citow(
this, last))
981 template <
typename OutputIterator,
982 typename InputIterator1,
983 typename InputIterator2>
984 OutputIterator
reduce(OutputIterator d_first,
985 InputIterator1 first,
986 InputIterator2 last) {
989 return detail::CongruenceCommon::reduce<ToddCoxeter>(
990 d_first, first, last);
1038 template <
typename Iterator1,
typename Iterator2>
1040 Iterator2 last)
const {
1041 return ToddCoxeterImpl::current_index_of_no_checks(
1042 detail::citow(
this, first), detail::citow(
this, last));
1068 template <
typename Iterator1,
typename Iterator2>
1098 template <
typename Iterator1,
typename Iterator2>
1100 return ToddCoxeterImpl::index_of_no_checks(detail::citow(
this, first),
1101 detail::citow(
this, last));
1128 template <
typename Iterator1,
typename Iterator2>
1183 template <
typename OutputIterator>
1186 return ToddCoxeterImpl::current_word_of_no_checks(
1187 detail::itow(
this, d_first), i)
1213 template <
typename OutputIterator>
1215 return ToddCoxeterImpl::current_word_of(detail::itow(
this, d_first), i)
1241 template <
typename Iterator>
1243 return ToddCoxeterImpl::word_of_no_checks(detail::itow(
this, d_first), i)
1270 template <
typename Iterator>
1272 return ToddCoxeterImpl::word_of(detail::itow(
this, d_first), i).get();
1286 template <
typename Word>
1297 template <
typename Word>
1308 template <
typename Word>
1319 template <
typename Node>
1321 -> ToddCoxeter<word_type>;
1331 template <
typename Node>
1342 template <
typename Word>
1353 template <
typename Word>
1372 template <
typename Word>
1376#include "todd-coxeter-class.tpp"
For an implementation of presentations for semigroups or monoids.
Definition presentation.hpp:103
Class for representing word graphs.
Definition word-graph.hpp:83
std::string to_human_readable_repr(Action< Element, Point, Func, Traits, LeftOrRight > const &action)
Return a human readable representation of an Action object.
Presentation(Presentation< Word > const &) -> Presentation< Word >
Deduction guide.
ToddCoxeter(congruence_kind, Presentation< Word > const &) -> ToddCoxeter< Word >
Deduction guide.
OutputIterator current_word_of(OutputIterator d_first, index_type i) const
Insert a current word representing a class with given index into an output iterator.
Definition todd-coxeter-class.hpp:1214
Iterator word_of_no_checks(Iterator d_first, index_type i)
Insert the word representing a class with given index into an output iterator.
Definition todd-coxeter-class.hpp:1242
Iterator word_of(Iterator d_first, index_type i)
Insert the word representing a class with given index into an output iterator.
Definition todd-coxeter-class.hpp:1271
OutputIterator current_word_of_no_checks(OutputIterator d_first, index_type i) const
Insert a current word representing a class with given index into an output iterator.
Definition todd-coxeter-class.hpp:1184
ToddCoxeter(congruence_kind knd, Presentation< Word > &&p)
Construct from congruence_kind and Presentation.
Definition todd-coxeter-class.hpp:465
ToddCoxeter & init(congruence_kind knd, Presentation< Word > &&p)
Re-initialize a ToddCoxeter instance.
ToddCoxeter & operator=(ToddCoxeter &&)=default
Move assignment operator.
ToddCoxeter()=default
Default constructor.
ToddCoxeter & init(congruence_kind knd, WordGraph< Node > const &wg)
Re-initialize a ToddCoxeter instance.
void throw_if_letter_not_in_alphabet(Iterator1 first, Iterator2 last) const
Throws if any letter in a range is out of bounds.
Definition todd-coxeter-class.hpp:625
ToddCoxeter & operator=(ToddCoxeter const &)=default
Copy assignment operator.
ToddCoxeter(ToddCoxeter const &)=default
ToddCoxeter(congruence_kind knd, WordGraph< Node > const &wg)
Construct from congruence_kind and WordGraph.
Definition todd-coxeter-class.hpp:564
ToddCoxeter(congruence_kind knd, Presentation< Word > const &p)
Construct from congruence_kind and Presentation.
Definition todd-coxeter-class.hpp:487
ToddCoxeter(ToddCoxeter &&)=default
ToddCoxeter & init(congruence_kind knd, Presentation< Word > const &p)
Re-initialize a ToddCoxeter instance.
Definition todd-coxeter-class.hpp:493
ToddCoxeter & init()
Re-initialize a ToddCoxeter instance.
ToddCoxeter & init(congruence_kind knd, ToddCoxeter const &tc)
Re-initialize a ToddCoxeter instance.
Definition todd-coxeter-class.hpp:533
ToddCoxeter(congruence_kind knd, ToddCoxeter const &tc)
Construct from congruence_kind and ToddCoxeter.
Definition todd-coxeter-class.hpp:513
OutputIterator reduce_no_checks(OutputIterator d_first, InputIterator1 first, InputIterator2 last)
Reduce a word with no checks.
Definition todd-coxeter-class.hpp:949
bool contains_no_checks(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Check containment of a pair of words via iterators.
Definition todd-coxeter-class.hpp:819
tril currently_contains(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2) const
Check containment of a pair of words via iterators.
Definition todd-coxeter-class.hpp:788
OutputIterator reduce(OutputIterator d_first, InputIterator1 first, InputIterator2 last)
Reduce a word.
Definition todd-coxeter-class.hpp:984
size_t number_of_generating_pairs() const noexcept
Returns the number of generating pairs.
ToddCoxeter & add_generating_pair(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add generating pair via iterators.
Definition todd-coxeter-class.hpp:715
std::vector< Word > const & generating_pairs() const noexcept
Get the generating pairs of the congruence.
Definition todd-coxeter-class.hpp:643
tril currently_contains_no_checks(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2) const
Check containment of a pair of words via iterators.
Definition todd-coxeter-class.hpp:753
bool contains(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Check containment of a pair of words via iterators.
ToddCoxeter & add_generating_pair_no_checks(Iterator1 first1, Iterator2 last1, Iterator3 first2, Iterator4 last2)
Add generating pair via iterators.
congruence_kind kind() const noexcept
The kind of the congruence (1- or 2-sided).
Presentation< Word > const & presentation() const noexcept
Get the presentation used to define a ToddCoxeter instance (if any).
Definition todd-coxeter-class.hpp:663
OutputIterator reduce_no_run_no_checks(OutputIterator d_first, InputIterator1 first, InputIterator2 last) const
Reduce a word with no enumeration or checks.
Definition todd-coxeter-class.hpp:883
OutputIterator reduce_no_run(OutputIterator d_first, InputIterator1 first, InputIterator2 last) const
Reduce a word with no enumeration.
Definition todd-coxeter-class.hpp:916
typename detail::ToddCoxeterImpl::word_graph_type word_graph_type
The type of the underlying WordGraph.
Definition todd-coxeter-class.hpp:385
typename detail::ToddCoxeterImpl::node_type node_type
The type of the nodes in the word graph.
Definition todd-coxeter-class.hpp:377
typename detail::ToddCoxeterImpl::index_type index_type
The type of the index of a class.
Definition todd-coxeter-class.hpp:402
typename detail::ToddCoxeterImpl::label_type label_type
The type of the edge-labels in the word graph.
Definition todd-coxeter-class.hpp:410
Word native_word_type
Type of the letters in the relations of the presentation stored in a ToddCoxeter instance.
Definition todd-coxeter-class.hpp:369
index_type current_index_of(Iterator1 first, Iterator2 last) const
Returns the current index of the class containing a word.
Definition todd-coxeter-class.hpp:1069
index_type current_index_of_no_checks(Iterator1 first, Iterator2 last) const
Returns the current index of the class containing a word.
Definition todd-coxeter-class.hpp:1039
index_type index_of_no_checks(Iterator1 first, Iterator2 last)
Returns the index of the class containing a word.
Definition todd-coxeter-class.hpp:1099
index_type index_of(Iterator1 first, Iterator2 last)
Returns the index of the class containing a word.
Definition todd-coxeter-class.hpp:1129
tril
Enum to indicate true, false or not currently knowable.
Definition types.hpp:54
congruence_kind
Enum to indicate the sided-ness of a congruence.
Definition types.hpp:67
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
Struct containing various options that can be used to control the behaviour of Todd-Coxeter.
Definition todd-coxeter-class.hpp:157
lookahead_style
Enum class for specifying the style of any lookahead performed.
Definition todd-coxeter-class.hpp:243
lookahead_extent
Enum class for specifying the extent of any lookahead performed.
Definition todd-coxeter-class.hpp:226
@ partial
Definition todd-coxeter-class.hpp:234
@ full
Definition todd-coxeter-class.hpp:230
strategy
Enum class containing various strategies.
Definition todd-coxeter-class.hpp:168
@ CR
Definition todd-coxeter-class.hpp:187
@ Cr
Definition todd-coxeter-class.hpp:206
@ hlt
Definition todd-coxeter-class.hpp:172
@ felsch
Definition todd-coxeter-class.hpp:177
@ Rc
Definition todd-coxeter-class.hpp:217
@ R_over_C
Definition todd-coxeter-class.hpp:196
def_version
Values for specifying how to handle edge definitions.
Definition todd-coxeter-class.hpp:320
@ two
Version 2 definition processing.
Definition todd-coxeter-class.hpp:324
@ one
Version 1 definition processing.
Definition todd-coxeter-class.hpp:322
def_policy
Enum class containing values for specifying how to handle edge definitions.
Definition todd-coxeter-class.hpp:274
@ discard_all_if_no_space
Definition todd-coxeter-class.hpp:291
@ unlimited
Definition todd-coxeter-class.hpp:294
@ no_stack_if_no_space
Definition todd-coxeter-class.hpp:277
@ purge_from_top
Definition todd-coxeter-class.hpp:282
@ purge_all
Definition todd-coxeter-class.hpp:287