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
true
if the input wordw
is 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
True
if the words is equivalent andFalse
otherwise.- Raises
RuntimeError -- if no presentation was set at the construction of
s
or 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
true
if the input wordw
is 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
True
ifw
is a left factor ofStephen.word()
andFalse
if not.- Return type
- Raises
RuntimeError -- if no presentation was set at the construction of
s
or 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
s
or 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 instances
with length betweenmin
andmax
. This is the same as the number of paths inStephen.word_graph()
(ifStephen.run()
has been called) with source0
and length in the rangemin
tomax
.- Parameters
- Returns
An
int
.- Raises
RuntimeError -- if no presentation was set at the construction of
s
or 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 instances
with length betweenmin
andmax
. 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 rangemin
tomax
.- Parameters
- Returns
An
int
.- Raises
RuntimeError -- if no presentation was set at the construction of
s
or 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
s
or 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.