size

uint64_t libsemigroups::fpsemigroup::KnuthBendix::size() override

Returns the size of the finitely presented semigroup.

Return

A size_t, the value of which equals the size of this if this number is finite, or libsemigroups::POSITIVE_INFINITY in some cases if this number is not finite.

Exceptions

This function guarantees not to throw a LibsemigroupsException.

Complexity

See warning.

Warning

The problem of determining the return value of this function is undecidable in general, and this function may never terminate.

Parameters

(None)

Note

If this has been run until finished, then this function can determine the size of the semigroup represented by this even if it is infinite. Moreover, the complexity of this function is at worst \(O(mn)\) where \(m\) is the number of letters in the alphabet, and \(n\) is the number of nodes in the KnuthBendix::gilman_digraph.