Kambites¶
On this page we describe the functionality relating to the algorithms for small
overlap monoids by Kambites and the authors of libsemigroups
.
>>> from libsemigroups_pybind11 import Kambites, POSITIVE_INFINITY
>>> k = Kambites()
>>> k.set_alphabet("abcd")
>>> k.add_rule("abcd", "accca");
>>> k.number_of_pieces(0) == POSITIVE_INFINITY
True
>>> k.number_of_pieces(1)
4
>>> k.small_overlap_class()
4
>>> k.normal_form("bbcabcdaccaccabcddd")
'bbcabcdaccaccabcddd'
>>> k.equal_to("bbcabcdaccaccabcddd", "bbcabcdaccaccabcddd")
True
Overloaded function. |
|
Overloaded function. |
|
Add rules from a |
|
Overloaded function. |
|
Convert a |
|
Check if the runner is dead. |
|
Overloaded function. |
|
Check if the main algorithm, implemented in this class, has been run to completion or not. |
|
Returns an isomorphic |
|
Check if an isomorphic |
|
Check if an identity has been set. |
|
Returns the identity (if any). |
|
Returns the inverses (if any). |
|
Check if the finitely presented semigroup is obviously finite. |
|
Check if the finitely presented semigroup is obviously infinite. |
|
Stop running the main algorithm(s) (thread-safe). |
|
Overloaded function. |
|
Returns the number of normal forms with length in a given range. |
|
Returns the minimum number of pieces required to factorise the \(i\)-th relation word. |
|
Returns the number of rules. |
|
Check if it is time to report. |
|
Set the minimum elapsed time between reports. |
|
Report why we stopped. |
|
Returns an iterator to the rules. |
|
Run the algorithm until it finishes. |
|
Run for a specified amount of time. |
|
Run until a nullary predicate returns |
|
Check if currently running. |
|
Overloaded function. |
|
Overloaded function. |
|
Set the inverses of letters in |
|
Returns the size of the finitely presented semigroup or |
|
Get the small overlap class. |
|
Check if |
|
Check if the runner is stopped. |
|
Check if the main algorithm was, or should be, stopped by the nullary predicate passed as first argument to |
|
Convert a string to a word. |
|
Check if the main algorithm has or should timed out. |
|
Convert a |
|
Overloaded function. |
|
Overloaded function. |
|
Convert a |
- class Kambites(*args, **kwargs)¶
Overloaded function.
__init__(self: _libsemigroups_pybind11.Kambites) -> None
__init__(self: _libsemigroups_pybind11.Kambites, arg0: _libsemigroups_pybind11.Kambites) -> None
- add_rule(*args, **kwargs)¶
Overloaded function.
add_rule(self: _libsemigroups_pybind11.Kambites, rel: Tuple[List[int], List[int]]) -> None
Add a rule using a tuple of lists of ints.
- Parameters
rel (Tuple[List[int], List[int]]) - the rule being added.
- Returns
(None)
add_rule(self: _libsemigroups_pybind11.Kambites, u: str, v: str) -> None
Add a rule using strings.
- Parameters
u (str) - the left-hand side of the rule being added.
v (str) - the right-hand side of the rule being added.
- Returns
(None)
add_rule(self: _libsemigroups_pybind11.Kambites, u: List[int], v: List[int]) -> None
Add a rule using two word_type const references.
- Parameters
u (List[int]) - the left-hand side of the rule being added.
v (List[int]) - the right-hand side of the rule being added.
- Returns
(None)
- add_rules(self: _libsemigroups_pybind11.Kambites, S: libsemigroups::FroidurePinBase) None ¶
Add rules from a
FroidurePin
instance.- Parameters
S (FroidurePin) - a
FroidurePin
object representing a semigroup.- Returns
(None)
- alphabet(*args, **kwargs)¶
Overloaded function.
alphabet(self: _libsemigroups_pybind11.Kambites, i: int) -> str
Returns the ith letter of the alphabet.
- Parameters
i (int) - the index of the letter.
- Returns
A string.
alphabet(self: _libsemigroups_pybind11.Kambites) -> str
Returns the alphabet.
- Returns
A string.
- char_to_uint(self: _libsemigroups_pybind11.Kambites, a: str) int ¶
Convert a
char
to aletter_type
.- Parameters
a (str) -- the string to convert.
- Returns
An
int
.
- dead(self: libsemigroups::Runner) bool ¶
Check if the runner is dead.
- Parameters
None
- Returns
A
bool
.
- equal_to(*args, **kwargs)¶
Overloaded function.
equal_to(self: _libsemigroups_pybind11.Kambites, u: str, v: str) -> bool
Check if two words represent the same element.
- Parameters
u (str) - first word for comparison.
v (str) - second word for comparison.
- Returns
True
if the stringsu
andv
represent the same element of the finitely presented semigroup, andFalse
otherwise.
equal_to(self: _libsemigroups_pybind11.Kambites, u: List[int], v: List[int]) -> bool
Check if two words represent the same element.
- Parameters
u (List[int]) - first word for comparison.
v (List[int]) - second word for comparison.
- Returns
True
if the wordsu
andv
represent the same element of the finitely presented semigroup, andFalse
otherwise.
- finished(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the main algorithm, implemented in this class, has been run to completion or not.
- Parameters
None
- Returns
A
bool
.
- froidure_pin(self: _libsemigroups_pybind11.Kambites) libsemigroups::FroidurePinBase ¶
Returns an isomorphic
FroidurePin
instance.- Returns
A
FroidurePinBase
.
- has_froidure_pin(self: libsemigroups::FpSemigroupInterface) bool ¶
Check if an isomorphic
FroidurePin
instance is known.- Returns
A bool.
- has_identity(self: libsemigroups::FpSemigroupInterface) bool ¶
Check if an identity has been set.
- Returns
A
bool
.
- identity(self: _libsemigroups_pybind11.Kambites) str ¶
Returns the identity (if any).
- Returns
A string.
- inverses(self: _libsemigroups_pybind11.Kambites) str ¶
Returns the inverses (if any).
- Returns
A string.
- is_obviously_finite(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the finitely presented semigroup is obviously finite.
- Returns
A
bool
.
- is_obviously_infinite(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the finitely presented semigroup is obviously infinite.
- Returns
A
bool
.
- kill(self: libsemigroups::Runner) None ¶
Stop running the main algorithm(s) (thread-safe).
- Parameters
None
- Returns
(None).
- normal_form(*args, **kwargs)¶
Overloaded function.
normal_form(self: _libsemigroups_pybind11.Kambites, w: str) -> str
Returns a normal form for a string.
- Parameters
w (str) - the word whose normal form we want to find.
- Returns
A
str
.
normal_form(self: _libsemigroups_pybind11.Kambites, w: List[int]) -> List[int]
Returns a normal form for a word_type.
- Parameters
w (List[int]) - the word whose normal form we want to find.
- Returns
The normal form of the parameter
w
, a value of typeList[int]
.
- number_of_normal_forms(self: _libsemigroups_pybind11.Kambites, min: int, max: int) int ¶
Returns the number of normal forms with length in a given range.
- number_of_pieces(self: _libsemigroups_pybind11.Kambites, i: int) int ¶
Returns the minimum number of pieces required to factorise the \(i\)-th relation word.
- Parameters
i (int) -- the index of the relation word
- Returns
An
int
.
- number_of_rules(self: libsemigroups::FpSemigroupInterface) int ¶
Returns the number of rules.
- Returns
An
int
.
- report(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if it is time to report.
- Parameters
None
- Returns
A
bool
.
- report_every(self: _libsemigroups_pybind11.Kambites, t: std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >) None ¶
Set the minimum elapsed time between reports.
- Parameters
t (datetime.timedelta) -- the amount of time between reports.
- Returns
(None)
- report_why_we_stopped(self: _libsemigroups_pybind11.Kambites) None ¶
Report why we stopped.
- Parameters
None
- Returns
(None)
- rules(self: _libsemigroups_pybind11.Kambites) Iterator ¶
Returns an iterator to the rules.
- run(self: _libsemigroups_pybind11.Kambites) None ¶
Run the algorithm until it finishes. :Parameters: None
- Returns
(None)
- run_for(self: _libsemigroups_pybind11.Kambites, t: std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >) None ¶
Run for a specified amount of time.
- Parameters
t (datetime.timedelta) -- the time to run for.
- Returns
(None)
>>> from datetime import timedelta >>> from libsemigroups_pybind11 import ToddCoxeter, congruence_kind >>> tc = ToddCoxeter(congruence_kind.twosided) >>> tc.set_number_of_generators(1) >>> tc.add_pair([0] * 1000, [0] * 999) >>> tc.run_for(timedelta(microseconds=10))
- run_until(self: _libsemigroups_pybind11.Kambites, func: std::__1::function<bool ()>) None ¶
Run until a nullary predicate returns
True
orfinished()
.- Parameters
func (Callable[], bool) -- a function.
- Returns
(None)
- running(self: libsemigroups::Runner) bool ¶
Check if currently running.
- Parameters
(None)
- Returns
True
ifrun()
is in the process of running andFalse
if it is not.
See also
- set_alphabet(*args, **kwargs)¶
Overloaded function.
set_alphabet(self: _libsemigroups_pybind11.Kambites, n: int) -> None
Set the size of the alphabet.
- Parameters
n (int) - the number of letters.
- Returns
(None)
set_alphabet(self: _libsemigroups_pybind11.Kambites, a: str) -> None
Set the alphabet of the finitely presented semigroup.
- Parameters
a (str) - the alphabet.
- Returns
(None)
- set_identity(*args, **kwargs)¶
Overloaded function.
set_identity(self: _libsemigroups_pybind11.Kambites, id: int) -> None
Set a character in alphabet() to be the identity using its index.
- Parameters
id (int) - the index of the character to be the identity.
- Returns
(None)
set_identity(self: _libsemigroups_pybind11.Kambites, id: str) -> None
Set a character in alphabet() to be the identity.
- Parameters
id (str) - a string containing the character to be the identity.
- Returns
(None)
- set_inverses(self: _libsemigroups_pybind11.Kambites, a: str) None ¶
Set the inverses of letters in
alphabet()
.- Parameters
a (str) -- a string of length
len(~Kambites.alphabet())`()
.- Returns
(None)
- size(self: _libsemigroups_pybind11.Kambites) int ¶
Returns the size of the finitely presented semigroup or
POSITIVE_INFINITY
.- Returns
An
int
.
- small_overlap_class(self: _libsemigroups_pybind11.Kambites) int ¶
Get the small overlap class.
- Returns
The greatest positive integer \(n\) such that the finitely semigroup represented by this satisfies the condition \(C(n)\); or
POSITIVE_INFINITY
if no word occurring in a relation can be written as a product of pieces.
- started(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if
run()
has been called at least once before.Returns
True
ifrun()
has started to run (it can be running or not).- Parameters
(None)
- Returns
A
bool
.
See also
- stopped(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the runner is stopped.
This function can be used to check whether or not
run()
has been stopped for whatever reason. In other words, it checks iftimed_out()
,finished()
, ordead()
.- Parameters
None
- Returns
A
bool
.
- stopped_by_predicate(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the main algorithm was, or should be, stopped by the nullary predicate passed as first argument to
run_until()
.- Parameters
None
- Returns
A
bool
.
- string_to_word(self: _libsemigroups_pybind11.Kambites, w: str) List[int] ¶
Convert a string to a word.
- Parameters
w (str) -- the string to convert.
- Returns
A
List[int]
.
- timed_out(self: _libsemigroups_pybind11.Kambites) bool ¶
Check if the main algorithm has or should timed out.
- Parameters
None
- Returns
A
bool
.
- uint_to_char(self: _libsemigroups_pybind11.Kambites, a: int) str ¶
Convert a
int
to achar
.- Parameters
a (int) -- the letter to convert.
- Returns
A
char
.
- ukkonen(self: _libsemigroups_pybind11.Kambites) libsemigroups::Ukkonen ¶
TODO
- validate_letter(*args, **kwargs)¶
Overloaded function.
validate_letter(self: _libsemigroups_pybind11.Kambites, c: str) -> None
Validates a letter specified by a string.
- Parameters
c (str) - the letter to validate.
- Returns
(None)
validate_letter(self: _libsemigroups_pybind11.Kambites, c: int) -> None
Validates a letter specified by an integer.
- Parameters
c (int) - the letter to validate.
- Returns
(None)
- validate_word(*args, **kwargs)¶
Overloaded function.
validate_word(self: _libsemigroups_pybind11.Kambites, w: List[int]) -> None
Validates a word given by a
List[int]
.- Parameters
w (List[int]) - the word to validate.
- Returns
(None)
validate_word(self: _libsemigroups_pybind11.Kambites, w: str) -> None
Validates a word given by a string.
- Parameters
w (str) - the word to validate.
- Returns
(None)
- word_to_string(self: _libsemigroups_pybind11.Kambites, w: List[int]) str ¶
Convert a
List[int]
to astr
.- Parameters
w (List[int]) -- the word to convert.
- Returns
A string.