Stephen helpers¶
This page contains the documentation for various helper functions for
manipulating Stephen objects. All such functions are contained in
stephen module.
Contents¶
Check if a word is equivalent to |
|
Check if a word is a left factor of |
|
Returns an iterator pointing at the first word (in short-lex order)
that is a left factor of |
|
Returns the number of left factors with length in given range. |
|
Returns the number of words accepted with length in a given range. |
|
Returns an iterator pointing at the first word equivalent to
|
Full API¶
- accepts(s: _libsemigroups_pybind11.Stephen, w: List[int]) bool¶
Check if a word is equivalent to
Stephen.word().This function triggers the algorithm implemented in this class (if it hasn't been triggered already), and then returns
trueif the input wordwis equivalent toStephen.word()in the semigroup defined byStephen.presentation(). A word is equivalent toStephen.word()if it labels a path inStephen.word_graph()with source c 0 and targetStephen.accept_state().- Parameters
- Returns
Trueif the words is equivalent andFalseotherwise.- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().- Warning
The problem of determining whether two words are equal in a finitely presented semigroup is undecidable in general, and this function may never terminate.
- is_left_factor(s: _libsemigroups_pybind11.Stephen, w: List[int]) bool¶
Check if a word is a left factor of
Stephen.word().This function triggers the algorithm implemented in this class (if it hasn't been triggered already), and then returns
trueif the input wordwis a left factor ofStephen.word()in the semigroup defined byStephen.presentation(). A word is a left factor ofStephen.word()if it labels a path inStephen.word_graph()with source0.- Parameters
- Returns
Trueifwis a left factor ofStephen.word()andFalseif not.- Return type
- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().- Warning
The problem of determining whether a word is a left factor of another word in a finitely presented semigroup is undecidable in general, and this function may never terminate.
- left_factors(s: _libsemigroups_pybind11.Stephen, min: int = 0, max: int = 18446744073709551614) Iterator¶
Returns an iterator pointing at the first word (in short-lex order) that is a left factor of
Stephen.word().This function triggers the algorithm implemented in this class (if it hasn't been triggered already).
- Parameters
- Returns
An iterator.
- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().- Warning
The problem of determining whether a word is a left factor of another word in a finitely presented semigroup is undecidable in general, and this function may never terminate.
- number_of_left_factors(s: _libsemigroups_pybind11.Stephen, min: int = 0, max: int = 18446744073709551614) int¶
Returns the number of left factors with length in a given range.
This function returns the number of left factors of the
Stephen.word()in the instanceswith length betweenminandmax. This is the same as the number of paths inStephen.word_graph()(ifStephen.run()has been called) with source0and length in the rangemintomax.- Parameters
- Returns
An
int.- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().
- number_of_words_accepted(s: _libsemigroups_pybind11.Stephen, min: int = 0, max: int = 18446744073709551614) int¶
Returns the number of words accepted with length in a given range.
This function returns the number of words that are equivalent to
Stephen.word()in the instanceswith length betweenminandmax. This is the same as the number of paths inStephen.word_graph()(ifStephen.run()has been called) with source0, targetStephen.accept_state(), and length in the rangemintomax.- Parameters
- Returns
An
int.- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().
See also
- words_accepted(s: _libsemigroups_pybind11.Stephen, min: int = 0, max: int = 18446744073709551614) Iterator¶
Returns an iterator pointing at the first word equivalent to
Stephen.word()in short-lex order.This function triggers the algorithm implemented in this class (if it hasn't been triggered already).
- Parameters
- Returns
An iterator.
- Raises
RuntimeError -- if no presentation was set at the construction of
sor withStephen.init().- Warning
The problem of determining whether two words are equal in a finitely presented semigroup is undecidable in general, and this function may never terminate.
See also
ActionDigraph.pstislo()for more information about the iterators returned by this function.