FpSemigroup

class FpSemigroup : public libsemigroups::FpSemigroupInterface

Defined in fpsemi.hpp.

This is a class for representing finitely presented semigroups and monoids.

On this page we describe the functionality relating to the FpSemigroup class. This class can be used for computing a finitely presented semigroup or monoid by running every applicable algorithm from libsemigroups (and possibly some variants of the same algorithm) in parallel. This class is provided for convenience, at present it is not very customisable, and lacks some of the fine grained control offered by the classes implementing individual algorithms, such as fpsemigroup::ToddCoxeter and fpsemigroup::KnuthBendix.

Example

FpSemigroup S;
S.set_alphabet(3);
S.set_identity(0);
S.add_rule({1, 2}, {0});
S.is_obviously_infinite();  // false

Member types

char_type

Type for characters.

const_iterator

Type for const iterators to the defining rules.

rule_type

Type for rules.

string_type

Type for strings.

Constructors

FpSemigroup()

Default construct an FpSemigroup .

FpSemigroup(FpSemigroup const&) = default

Default copy constructor.

FpSemigroup(T const&)

Construct an FpSemigroup isomorphic to the FroidurePin instance S.

FpSemigroup(std::shared_ptr<FroidurePinBase>)

Construct an FpSemigroup isomorphic to the FroidurePin instance S.

Deleted constructors

FpSemigroup(FpSemigroup&&) = delete

A FpSemigroup instance is not move copyable.

operator=(FpSemigroup const&) = delete

A FpSemigroup instance is not copy assignable.

operator=(FpSemigroup&&) = delete

A FpSemigroup instance is not move assignable.

Settings

max_threads() const noexcept

Get the current maximum number of threads.

max_threads(size_t) noexcept

Set the maximum number of threads.

Member functions inherited from FpSemigroupInterface

add_rule(relation_type)

Add a rule using a relation_type .

add_rule(rule_type)

Add a rule using a rule_type .

add_rule(std::initializer_list<size_t>, std::initializer_list<size_t>)

Add a rule using two word_type const references.

add_rule(std::string const&, std::string const&)

Add a rule using two std::string const references.

add_rule(word_type const&, word_type const&)

Add a rule using two word_type const references.

add_rules(FroidurePinBase&)

Add rules from a FroidurePin instance.

add_rules(std::vector<rule_type> const&)

Add rules in a vector.

alphabet() const noexcept

Returns a const reference to the alphabet.

alphabet(size_t) const

Returns the i th letter of the alphabet.

cbegin_rules() const noexcept

Returns an iterator pointing to the first rule.

cend_rules() const noexcept

Returns an iterator pointing one past the last rule.

char_to_uint(char) const

Convert a char to a letter_type .

equal_to(std::initializer_list<letter_type>, std::initializer_list<letter_type>)

Check if two words represent the same element.

equal_to(std::string const&, std::string const&) override

Check if two strings represent the same element.

equal_to(word_type const&, word_type const&)

Check if two words represent the same element.

froidure_pin()

Returns an isomorphic FroidurePin instance.

has_froidure_pin() const noexcept

Check if an isomorphic FroidurePin instance is known.

has_identity() const noexcept

Check if an identity has been set.

identity() const

Returns the identity (if any).

inverses() const

Returns the inverses (if any).

is_obviously_finite()

Check if the finitely presented semigroup is obviously finite.

is_obviously_infinite()

Check if the finitely presented semigroup is obviously infinite.

normal_form(std::initializer_list<letter_type>)

Returns a normal form for a word_type .

normal_form(std::string const&) override

Returns a normal form for a string.

normal_form(word_type const&)

Returns a normal form for a word_type .

number_of_rules() const noexcept

Returns the number of rules.

set_alphabet(size_t)

Set the size of the alphabet.

set_alphabet(std::string const&)

Set the alphabet of the finitely presented semigroup.

set_identity(letter_type)

Set a character in alphabet() to be the identity using its index.

set_identity(std::string const&)

Set a character in alphabet() to be the identity.

set_inverses(std::string const&)

Set the inverses of letters in alphabet() .

size() override

Returns the size of the finitely presented semigroup.

string_to_word(std::string const&) const

Convert a string to a word_type .

to_gap_string()

Returns a string containing GAP commands for defining a finitely presented semigroup.

uint_to_char(letter_type) const

Convert a letter_type to a char.

validate_letter(char) const

Validates a letter specified by a char.

validate_letter(letter_type) const

Validates a letter specified by an integer.

validate_word(std::string const&) const

Validates a word given by a std::string.

validate_word(word_type const&) const

Validates a word given by a word_type .

word_to_string(word_type const&) const

Convert a word_type to a std::string.

Member functions inherited from Runner

dead() const noexcept

Check if the runner is dead.

finished() const

Check if run has been run to completion or not.

kill() noexcept

Stop run from running (thread-safe).

report() const

Check if it is time to report.

report_every() const noexcept

Get the minimum elapsed time between reports.

report_every(TIntType)

Set the minimum elapsed time between reports.

report_every(std::chrono::nanoseconds)

Set the minimum elapsed time between reports.

report_why_we_stopped() const

Report why run stopped.

run()

Run until finished .

run_for(TIntType)

Run for a specified amount of time.

run_for(std::chrono::nanoseconds)

Run for a specified amount of time.

run_until(T&&)

Run until a nullary predicate returns true or finished .

run_until(bool(*)())

Run until a nullary predicate returns true or finished .

running() const noexcept

Check if currently running.

running_for() const noexcept

Check if the runner is currently running for a particular length of time.

running_until() const noexcept

Check if the runner is currently running until a nullary predicate returns true.

started() const

Check if run has been called at least once before.

stopped() const

Check if the runner is stopped.

stopped_by_predicate() const

Check if the runner was, or should, stop because of the argument for run_until .

timed_out() const

Check if the amount of time passed to run_for has elapsed.