This file contains documentation for creating inverse semigroup and monoid presentations in libsemigroups
from other types of objects.
- See also
- The `to` function for an overview of possible conversions between
libsemigroups
types.
|
template<typename Result, typename Word> |
auto | to (InversePresentation< Word > const &ip) noexcept -> std::enable_if_t< std::is_same_v< InversePresentation< typename Result::word_type >, Result > &&!std::is_same_v< Word, typename Result::word_type >, Result > |
| Make an inverse presentation from a different type of inverse presentation.
|
|
template<typename Result, typename Word, typename Func> |
auto | to (InversePresentation< Word > const &ip, Func &&f) -> std::enable_if_t< std::is_same_v< InversePresentation< typename Result::word_type >, Result >, Result > |
| Make an inverse presentation from a different type of inverse presentation.
|
|
template<template< typename... > typename Thing, typename Word> |
auto | to (Presentation< Word > cont &p) -> std::enable_if_t< std::is_same_v< InversePresentation< Word >, Thing< Word > >, InversePresentation< Word > > |
| Make an inverse presentation from a presentation.
|
|
◆ to() [1/3]
template<typename Result, typename Word>
auto to |
( |
InversePresentation< Word > const & | ip | ) |
-> std::enable_if_t<
std::is_same_v<InversePresentation<typename Result::word_type>, Result>
&& !std::is_same_v<Word, typename Result::word_type>,
Result> |
|
noexcept |
Defined in to-presentation.hpp
.
Despite the hideous signature, this function should be invoked as follows:
auto to(detail::KnuthBendixImpl< Rewriter, ReductionOrder > &kb) -> std::enable_if_t< std::is_same_v< Presentation< typename Result::word_type >, Result >, Result >
No doc.
There are 2 versions of this function:
- When
typename Result::word_type
and Word
are not the same, this function returns an inverse presentation equivalent to the input inverse presentation but of a different type (for example, can be used to convert from std::string
to word_type).
- When
typename Result::word_type
and Word
are the same, this function just returns its argument ip
(as a reference), and is included solely for the purpose of simplifying certain client code, where inverse presentations must be converted from one type to another sometimes, but not other times.
If the alphabet of of ip
is \(\{a_0, a_1, \dots a_{n-1}\}\), then the conversion from InversePresentation<WordInput>::letter_type
to InversePresentation<WordOutput>::letter_type
is \(a_i \mapsto\) human_readable_letter<WordOutput>(size_t i)
.
- Template Parameters
-
Result | the return type, also used for SFINAE, should be InversePresentation<T> for some type T . |
Word | the type of the words in the input inverse presentation. |
- Parameters
-
ip | the input inverse presentation. |
- Returns
- A value of type
InversePresentation<WordOutput>
.
- Exceptions
-
LibsemigroupsException | if typename Result::word_type and Word are not the same and p.throw_if_bad_alphabet_or_rules() throws. If typename Result::word_type and Word are the same, then this function is noexcept . |
◆ to() [2/3]
template<typename Result, typename Word, typename Func>
Defined in to-presentation.hpp
.
Despite the hideous signature, this function should be invoked as follows:
This function returns an inverse presentation equivalent to the input inverse presentation but of a different type (for example, can be used to convert from std::string
to word_type). The second parameter specifies how to map the letters of one inverse presentation to the other.
- Template Parameters
-
Result | the return type, also used for SFINAE, should be InversePresentation<T> for some type T . |
Word | the type of the words in the input inverse presentation. |
Func | the type of a function for transforming letters. |
- Parameters
-
- Returns
- A value of type
InversePresentation<WordOutput>
.
- Exceptions
-
- Note
Func
must be a function type that is invocable with values of Presentation<Word>::letter_type
. If this is not true, then template substitution will fail.
◆ to() [3/3]
template<template< typename... > typename Thing, typename Word>
Defined in to-presentation.hpp
.
Despite the hideous signature, this function should be invoked as follows:
This function returns an inverse presentation with rules equivalent to those of the input presentation, but over a normalised alphabet. If the alphabet of p
is \(\{a_0, a_1, \dots, a_{n-1}\}\), then the alphabet of the returned inverse presentation will be \(\{0, 1, \dots, n-1, n, \dots, 2n-1\}\), where the inverse of letter \(i\) is the letter \(i + n\, (\text{mod }2n)\).
- Template Parameters
-
Thing | used for SFINAE, must be InversePresentation. |
Word | the type of the words in the input presentation. |
- Parameters
-
- Returns
- A value of type
InversePresentation<Word>
.
- Exceptions
-