libsemigroups  v3.3.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
to-knuth-bendix.hpp
1//
2// libsemigroups - C++ library for semigroups and monoids
3// Copyright (C) 2025 James D. Mitchell
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//
18
19#ifndef LIBSEMIGROUPS_TO_KNUTH_BENDIX_HPP_
20#define LIBSEMIGROUPS_TO_KNUTH_BENDIX_HPP_
21
22#include <type_traits>
23
24#include "knuth-bendix-class.hpp" // for KnuthBendix
25#include "presentation.hpp" // for Presentation
26#include "to-presentation.hpp" // for to<Presentation>
27
28namespace libsemigroups {
29
31 // Forward decls
33
34 class FroidurePinBase;
35
36 template <typename Word>
37 class ToddCoxeter;
38
39 enum class congruence_kind;
40
51
76 template <typename Result>
77 auto to(congruence_kind knd, FroidurePinBase& fpb) -> std::enable_if_t<
78 std::is_same_v<KnuthBendix<typename Result::native_word_type,
79 typename Result::rewriter_type>,
80 Result>,
81 Result> {
82 using Word = typename Result::native_word_type;
83 using Rewriter = typename Result::rewriter_type;
85 }
86
113 template <template <typename...> typename Thing, typename Word>
114 auto to(congruence_kind knd, ToddCoxeter<Word>& tc)
115 -> std::enable_if_t<std::is_same_v<Thing<Word>, KnuthBendix<Word>>,
116 KnuthBendix<Word>> {
117 // TODO(1) could do a version where we convert tc to FroidurePin, then use
118 // the rules of that instead?
119 return KnuthBendix<Word>(knd, tc.presentation());
120 }
121
148 template <typename Result>
150 ToddCoxeter<typename Result::native_word_type>& tc)
151 -> std::enable_if_t<
152 std::is_same_v<KnuthBendix<typename Result::native_word_type,
153 typename Result::rewriter_type>,
154 Result>,
155 Result> {
156 using Word = typename Result::native_word_type;
157 using Rewriter = typename Result::rewriter_type;
158 return KnuthBendix<Word, Rewriter>(knd, tc.presentation());
159 }
160
161} // namespace libsemigroups
162#endif // LIBSEMIGROUPS_TO_KNUTH_BENDIX_HPP_
Base class for FroidurePin containing non-element specific data and member functions.
Definition froidure-pin-base.hpp:67
For an implementation of presentations for semigroups or monoids.
Definition presentation.hpp:103
KnuthBendix(congruence_kind, Presentation< Word > const &) -> KnuthBendix< Word >
Deduction guide.
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
auto to(detail::KnuthBendixImpl< Rewriter, ReductionOrder > &kb) -> std::enable_if_t< std::is_same_v< Presentation< typename Result::word_type >, Result >, Result >
No doc.