libsemigroups  v3.6.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
to<InversePresentation>

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.

Functions

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 when typename Result::word_type and Word are not the same.
template<typename Result, typename Word>
auto to (InversePresentation< Word > const &ip) noexcept -> std::enable_if_t< std::is_same_v< InversePresentation< Word >, Result >, Result const & >
 Make an inverse presentation from a different type of inverse presentation when typename Result::word_type and Word are the same.
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 > const &p) -> std::enable_if_t< std::is_same_v< InversePresentation< Word >, Thing< Word > >, InversePresentation< Word > >
 Make an inverse presentation from a presentation.

Function Documentation

◆ to() [1/4]

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.

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).

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
Resultthe return type, also used for SFINAE, should be InversePresentation<T> for some type T.
Wordthe type of the words in the input inverse presentation.
Parameters
ipthe input inverse presentation.
Returns
A value of type InversePresentation<WordOutput>.
Exceptions
LibsemigroupsExceptionif p.throw_if_bad_alphabet_or_rules() throws.
Note
This function will be moved from the header to-presentation.hpp to presentation.hpp in v4 of libsemigroups.

◆ to() [2/4]

template<typename Result, typename Word>
auto to ( InversePresentation< Word > const & ip) -> std::enable_if_t< std::is_same_v< InversePresentation< Word >, Result >, Result const & >
noexcept

Defined in to-presentation.hpp.

Despite the hideous signature, this function should be invoked as follows:

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.

Template Parameters
Resultthe return type, also used for SFINAE, should be InversePresentation<T> for some type T.
Wordthe type of the words in the input inverse presentation.
Parameters
ipthe input inverse presentation.
Returns
A value of type InversePresentation<WordOutput>.

This function is noexcept and is guaranteed never to throw.

Note
This function will be moved from the header to-presentation.hpp to presentation.hpp in v4 of libsemigroups.

◆ to() [3/4]

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 >

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
Resultthe return type, also used for SFINAE, should be InversePresentation<T> for some type T.
Wordthe type of the words in the input inverse presentation.
Functhe type of a function for transforming letters.
Parameters
ipthe input inverse presentation.
fa function mapping InversePresentation<Word>::letter_type to Result::letter_type.
Returns
A value of type InversePresentation<WordOutput>.
Exceptions
LibsemigroupsExceptionif p.throw_if_bad_alphabet_or_rules() throws.
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.
This function will be moved from the header to-presentation.hpp to presentation.hpp in v4 of libsemigroups.

◆ to() [4/4]

template<template< typename... > typename Thing, typename Word>
auto to ( Presentation< Word > const & p) -> std::enable_if_t< std::is_same_v< InversePresentation< Word >, Thing< Word > >, InversePresentation< 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
Thingused for SFINAE, must be InversePresentation.
Wordthe type of the words in the input presentation.
Parameters
pthe input presentation.
Returns
A value of type InversePresentation<Word>.
Exceptions
LibsemigroupsExceptionif p.throw_if_bad_alphabet_or_rules() throws.
Note
This function will be moved from the header to-presentation.hpp to presentation.hpp in v4 of libsemigroups.