Making presentations from other objects¶
Defined in make-present.hpp
.
This page describes the functionality for creating semigroup and
monoid presentations in libsemigroups
from other types of objects.
-
template<typename T, typename = std::enable_if_t<std::is_base_of<PresentationBase, T>::value>>
T libsemigroups::make(FroidurePinBase &fp)¶ Make presentation from a FroidurePin object.
This function constructs and returns a Presentation object using the rules of a FroidurePin object, accessed via FroidurePin::cbegin_rules and FroidurePin::cend_rules.
No enumeration of the argument
fp
is performed, so it might be the case that the resulting presentation does not define the same semigroup asfp
. To ensure that the resulting presentation defines the same semigroup asfp
, run FroidurePin::run (or any other function that fully enumeratesfp
) prior to calling this function.- Template Parameters
T – the type of the presentation to construct (must be a type of Presentation).
- Parameters
fp – the FroidurePin object from which to obtain the rules.
- Throws
(None) – This function guarantees not to throw a LibsemigroupsException.
- Returns
An object of type
T
.
-
Presentation<std::string> libsemigroups::make(FroidurePinBase &fp, std::string const &alphabet)¶
Make presentation with strings from a FroidurePin object.
This function constructs and returns a Presentation object using the rules of a FroidurePin object, accessed via FroidurePin::cbegin_rules and FroidurePin::cend_rules.
No enumeration of the argument
fp
is performed, so it might be the case that the resulting presentation does not define the same semigroup asfp
. To ensure that the resulting presentation defines the same semigroup asfp
, run FroidurePin::run (or any other function that fully enumeratesfp
) prior to calling this function.- Template Parameters
T – the type of the presentation to construct (must be a type of Presentation).
- Parameters
fp – the FroidurePin object from which to obtain the rules.
alphabet – the alphabet of the presentation to be constructed.
- Throws
LibsemigroupsException – if the length of
alphabet
is not equal tofp.number_of_generators()
.LibsemigroupsException – if
Presentation::alphabet(alphabet)
throws.
- Returns
An object of type
T
.
-
template<typename S, typename T, typename F, typename = std::enable_if_t<std::is_base_of<PresentationBase, S>::value && std::is_base_of<PresentationBase, T>::value>>
S libsemigroups::make(T const &p, F &&f)¶ Make a presentation from a different type of presentation.
Returns a presentation equivalent to the input 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 presentation to the other.
- Template Parameters
S – the type of the returned presentation, must be a type of Presentation and distinct from
T
T – the type of the input presentation, must be a type of Presentation and distinct from
S
F – the type of a function from transforming letters
- Parameters
p – the input presentation
f – a function mapping S::letter_type to T::letter_type
- Throws
LibsemigroupsException – if
p.validate()
throws.- Returns
A value of type
S
.
-
template<typename S, typename T, typename = std::enable_if_t<std::is_base_of<PresentationBase, S>::value && std::is_base_of<PresentationBase, T>::value>>
S libsemigroups::make(T const &p)¶ Make a presentation from a different type of presentation.
Returns a presentation equivalent to the input presentation but of a different type (for example, can be used to convert from std::string to word_type).
The alphabet of the returned presentation is \(\{0, \ldots, n - 1\}\) where \(n\) is the size of the alphabet of the input presentation.
- Template Parameters
S – the type of the returned presentation, must be a type of Presentation and distinct from
T
T – the type of the input presentation, must be a type of Presentation and distinct from
S
- Parameters
p – the input presentation
- Throws
LibsemigroupsException – if
p.validate()
throws.- Returns
A value of type
S
.
-
template<typename T, typename = std::enable_if_t<std::is_base_of<PresentationBase, T>::value>>
Presentation<std::string> libsemigroups::make(T p, std::string const &alphabet)¶ Make a string presentation from a different type of presentation.
Returns a presentation equivalent to the input presentation but of a different type (for example, can be used to convert from std::string to word_type).
The alphabet of the returned presentation is the second parameter
alphabet
where \(n\) is the size of the alphabet of the input presentation.- Template Parameters
T – the type of the input presentation, must be a type of Presentation and distinct from
S
- Parameters
p – the input presentation
alphabet – the output presentations alphabet
- Throws
LibsemigroupsException – if
p.validate()
throws.- Returns
A value of type Presentation<std::string>.