26#ifndef LIBSEMIGROUPS_TODD_COXETER_CLASS_HPP_
27#define LIBSEMIGROUPS_TODD_COXETER_CLASS_HPP_
37#include "presentation.hpp"
38#include "to-presentation.hpp"
41#include "detail/citow.hpp"
42#include "detail/cong-common-class.hpp"
43#include "detail/fmt.hpp"
44#include "detail/todd-coxeter-impl.hpp"
135 template <
typename Word>
136 class ToddCoxeter :
public detail::ToddCoxeterImpl {
138 std::vector<Word> _generating_pairs;
142#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
150 struct options :
public FelschGraphSettings_::options {
370 using node_type =
typename detail::ToddCoxeterImpl::node_type;
395 using index_type =
typename detail::ToddCoxeterImpl::index_type;
403 using label_type =
typename detail::ToddCoxeterImpl::label_type;
507 : ToddCoxeterImpl(knd, tc), _presentation(tc.
presentation()) {}
526 ToddCoxeterImpl::init(knd, tc);
527 _presentation = tc.presentation();
549 template <
typename Node>
571 template <
typename Node>
574#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
578 template <
typename Node>
586 template <
typename Node>
610 template <
typename Iterator1,
typename Iterator2>
612 Iterator2 last)
const {
613 presentation().throw_if_letter_not_in_alphabet(first, last);
630 return _generating_pairs;
650 return _presentation;
674 template <
typename Iterator1,
697 template <
typename Iterator1,
707 return detail::CongruenceCommon::add_generating_pair<ToddCoxeter>(
708 first1, last1, first2, last2);
735 template <
typename Iterator1,
742 Iterator4 last2)
const {
743 return ToddCoxeterImpl::currently_contains_no_checks(
744 detail::citow(
this, first1),
745 detail::citow(
this, last1),
746 detail::citow(
this, first2),
747 detail::citow(
this, last2));
770 template <
typename Iterator1,
777 Iterator4 last2)
const {
780 return detail::CongruenceCommon::currently_contains<ToddCoxeter>(
781 first1, last1, first2, last2);
801 template <
typename Iterator1,
809 return ToddCoxeterImpl::contains_no_checks(detail::citow(
this, first1),
810 detail::citow(
this, last1),
811 detail::citow(
this, first2),
812 detail::citow(
this, last2));
832 template <
typename Iterator1,
866 template <
typename OutputIterator,
867 typename InputIterator1,
868 typename InputIterator2>
870 InputIterator1 first,
871 InputIterator2 last)
const {
872 return ToddCoxeterImpl::reduce_no_run_no_checks(
873 detail::itow(
this, d_first),
874 detail::citow(
this, first),
875 detail::citow(
this, last))
899 template <
typename OutputIterator,
900 typename InputIterator1,
901 typename InputIterator2>
903 InputIterator1 first,
904 InputIterator2 last)
const {
905 return detail::CongruenceCommon::reduce_no_run<ToddCoxeter>(
906 d_first, first, last);
932 template <
typename OutputIterator,
933 typename InputIterator1,
934 typename InputIterator2>
936 InputIterator1 first,
937 InputIterator2 last) {
938 return ToddCoxeterImpl::reduce_no_checks(detail::itow(
this, d_first),
939 detail::citow(
this, first),
940 detail::citow(
this, last))
967 template <
typename OutputIterator,
968 typename InputIterator1,
969 typename InputIterator2>
970 OutputIterator
reduce(OutputIterator d_first,
971 InputIterator1 first,
972 InputIterator2 last) {
975 return detail::CongruenceCommon::reduce<ToddCoxeter>(
976 d_first, first, last);
1024 template <
typename Iterator1,
typename Iterator2>
1026 Iterator2 last)
const {
1027 return ToddCoxeterImpl::current_index_of_no_checks(
1028 detail::citow(
this, first), detail::citow(
this, last));
1054 template <
typename Iterator1,
typename Iterator2>
1084 template <
typename Iterator1,
typename Iterator2>
1086 return ToddCoxeterImpl::index_of_no_checks(detail::citow(
this, first),
1087 detail::citow(
this, last));
1114 template <
typename Iterator1,
typename Iterator2>
1169 template <
typename OutputIterator>
1172 return ToddCoxeterImpl::current_word_of_no_checks(
1173 detail::itow(
this, d_first), i)
1199 template <
typename OutputIterator>
1201 return ToddCoxeterImpl::current_word_of(detail::itow(
this, d_first), i)
1227 template <
typename Iterator>
1229 return ToddCoxeterImpl::word_of_no_checks(detail::itow(
this, d_first), i)
1256 template <
typename Iterator>
1258 return ToddCoxeterImpl::word_of(detail::itow(
this, d_first), i).get();
1272 template <
typename Word>
1283 template <
typename Word>
1294 template <
typename Word>
1305 template <
typename Node>
1307 -> ToddCoxeter<word_type>;
1317 template <
typename Node>
1328 template <
typename Word>
1339 template <
typename Word>
1358 template <
typename Word>
1362#include "todd-coxeter-class.tpp"
For an implementation of presentations for semigroups or monoids.
Definition presentation.hpp:102
Class for representing word graphs.
Definition word-graph.hpp:82
std::string to_human_readable_repr(AhoCorasick const &ac)
Return a string representation.
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:1200
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:1228
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:1257
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:1170
ToddCoxeter(congruence_kind knd, Presentation< Word > &&p)
Construct from congruence_kind and Presentation.
Definition todd-coxeter-class.hpp:458
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:611
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:550
ToddCoxeter(congruence_kind knd, Presentation< Word > const &p)
Construct from congruence_kind and Presentation.
Definition todd-coxeter-class.hpp:480
ToddCoxeter(ToddCoxeter &&)=default
ToddCoxeter & init(congruence_kind knd, Presentation< Word > const &p)
Re-initialize a ToddCoxeter instance.
Definition todd-coxeter-class.hpp:486
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:525
ToddCoxeter(congruence_kind knd, ToddCoxeter const &tc)
Construct from congruence_kind and ToddCoxeter.
Definition todd-coxeter-class.hpp:506
OutputIterator reduce_no_checks(OutputIterator d_first, InputIterator1 first, InputIterator2 last)
Reduce a word with no checks.
Definition todd-coxeter-class.hpp:935
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:805
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:774
OutputIterator reduce(OutputIterator d_first, InputIterator1 first, InputIterator2 last)
Reduce a word.
Definition todd-coxeter-class.hpp:970
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:701
std::vector< Word > const & generating_pairs() const noexcept
Get the generating pairs of the congruence.
Definition todd-coxeter-class.hpp:629
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:739
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:649
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:869
OutputIterator reduce_no_run(OutputIterator d_first, InputIterator1 first, InputIterator2 last) const
Reduce a word with no enumeration.
Definition todd-coxeter-class.hpp:902
typename detail::ToddCoxeterImpl::word_graph_type word_graph_type
The type of the underlying WordGraph.
Definition todd-coxeter-class.hpp:378
typename detail::ToddCoxeterImpl::node_type node_type
The type of the nodes in the word graph.
Definition todd-coxeter-class.hpp:370
typename detail::ToddCoxeterImpl::index_type index_type
The type of the index of a class.
Definition todd-coxeter-class.hpp:395
typename detail::ToddCoxeterImpl::label_type label_type
The type of the edge-labels in the word graph.
Definition todd-coxeter-class.hpp:403
Word native_word_type
Type of the letters in the relations of the presentation stored in a ToddCoxeter instance.
Definition todd-coxeter-class.hpp:362
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:1055
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:1025
index_type index_of_no_checks(Iterator1 first, Iterator2 last)
Returns the index of the class containing a word.
Definition todd-coxeter-class.hpp:1085
index_type index_of(Iterator1 first, Iterator2 last)
Returns the index of the class containing a word.
Definition todd-coxeter-class.hpp:1115
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
Struct containing various options that can be used to control the behaviour of Todd-Coxeter.
Definition todd-coxeter-class.hpp:150
lookahead_style
Enum class for specifying the style of any lookahead performed.
Definition todd-coxeter-class.hpp:236
lookahead_extent
Enum class for specifying the extent of any lookahead performed.
Definition todd-coxeter-class.hpp:219
@ partial
Definition todd-coxeter-class.hpp:227
@ full
Definition todd-coxeter-class.hpp:223
strategy
Enum class containing various strategies.
Definition todd-coxeter-class.hpp:161
@ CR
Definition todd-coxeter-class.hpp:180
@ Cr
Definition todd-coxeter-class.hpp:199
@ hlt
Definition todd-coxeter-class.hpp:165
@ felsch
Definition todd-coxeter-class.hpp:170
@ Rc
Definition todd-coxeter-class.hpp:210
@ R_over_C
Definition todd-coxeter-class.hpp:189
def_version
Values for specifying how to handle edge definitions.
Definition todd-coxeter-class.hpp:313
@ two
Version 2 definition processing.
Definition todd-coxeter-class.hpp:317
@ one
Version 1 definition processing.
Definition todd-coxeter-class.hpp:315
def_policy
Enum class containing values for specifying how to handle edge definitions.
Definition todd-coxeter-class.hpp:267
@ discard_all_if_no_space
Definition todd-coxeter-class.hpp:284
@ unlimited
Definition todd-coxeter-class.hpp:287
@ no_stack_if_no_space
Definition todd-coxeter-class.hpp:270
@ purge_from_top
Definition todd-coxeter-class.hpp:275
@ purge_all
Definition todd-coxeter-class.hpp:280