Skip to content

Commit 7723380

Browse files
Update for changes in libsemigroups
1 parent 3fe484b commit 7723380

File tree

18 files changed

+185
-202
lines changed

18 files changed

+185
-202
lines changed

docs/source/data-structures/presentations/inverse-present.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Contents
3636
libsemigroups_pybind11.InversePresentation
3737
InversePresentationStrings.inverse
3838
InversePresentationStrings.inverses
39-
InversePresentationStrings.validate
39+
InversePresentationStrings.throw_if_bad_alphabet_rules_or_inverses
4040

4141
Full API
4242
--------

docs/source/data-structures/presentations/present-helpers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ Contents
5656
remove_redundant_generators
5757
remove_trivial_rules
5858
replace_subword
59-
replace_word_with_new_generator
6059
replace_word
60+
replace_word_with_new_generator
6161
reverse
62-
shortest_rule_length
6362
shortest_rule
63+
shortest_rule_length
6464
sort_each_rule
6565
sort_rules
6666
strongly_compress
67-
validate_semigroup_inverses
67+
throw_if_bad_inverses
6868

6969
Full API
7070
--------

docs/source/data-structures/presentations/present.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ Contents
4343
PresentationStrings.letter
4444
PresentationStrings.remove_generator
4545
PresentationStrings.rules
46-
PresentationStrings.validate
47-
PresentationStrings.validate_alphabet
48-
PresentationStrings.validate_letter
49-
PresentationStrings.validate_word
50-
PresentationStrings.validate_rules
46+
PresentationStrings.throw_if_bad_alphabet_or_rules
47+
PresentationStrings.throw_if_alphabet_not_duplicate_free
48+
PresentationStrings.throw_if_letter_not_in_alphabet
49+
PresentationStrings.throw_if_bad_rules
5150

5251
Full API
5352
--------

docs/source/data-structures/presentations/to-inverse-present.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ the alphabet of the returned :any:`InversePresentationStrings` will be
5454
:math:`\{0, 1, \dots, n-1, n, \dots, 2n-1\}`, where the inverse of letter
5555
:math:`i` is the letter :math:`i + n\, (\text{mod }2n)`.
5656

57-
This function throws a :any:`LibsemigroupsError` if ``p.validate()`` throws.
57+
This function throws a :any:`LibsemigroupsError` if
58+
``p.throw_if_bad_alphabet_or_rules()`` throws.
5859

5960
.. seealso::
6061

61-
* :any:`PresentationStrings.validate`.
62+
* :any:`PresentationStrings.throw_if_bad_alphabet_or_rules`.
6263

6364
.. doctest:: Python
6465

@@ -120,13 +121,14 @@ of type ``List[int]``, then the conversion from one type to another is
120121
:math:`a_i \mapsto` ``human_readable_letter(a_i)``.
121122

122123
This function throws a :any:`LibsemigroupsError` if the type of words in *ip* is
123-
not the same as that specified in *Return* and ``p.validate()`` throws.
124+
not the same as that specified in *Return* and
125+
``p.throw_if_bad_alphabet_rules_or_inverses()`` throws.
124126

125127
.. seealso::
126128

127129
* :any:`words.human_readable_index`;
128130
* :any:`words.human_readable_letter`; and
129-
* :any:`InversePresentationStrings.validate`.
131+
* :any:`InversePresentationStrings.throw_if_bad_alphabet_rules_or_inverses`.
130132

131133
.. doctest:: Python
132134

@@ -177,13 +179,14 @@ different type (for example, can be used to convert from :any:`str` to
177179
:any:`int`). The second parameter *f* specifies how to map the letters of one
178180
:any:`InversePresentationStrings` to the other.
179181

180-
This function throws a :any:`LibsemigroupsError` if ``ip.validate()`` throws, or
181-
if the function specified by *f* does not map letters of the type used in *ip*
182-
to letters of the type of word specified in *Return*.
182+
This function throws a :any:`LibsemigroupsError` if
183+
``ip.throw_if_bad_alphabet_rules_or_inverses()`` throws, or if the function
184+
specified by *f* does not map letters of the type used in *ip* to letters of
185+
the type of word specified in *Return*.
183186

184187
.. seealso::
185188

186-
* :any:`InversePresentationStrings.validate`.
189+
* :any:`InversePresentationStrings.throw_if_bad_alphabet_rules_or_inverses`.
187190

188191
.. doctest:: Python
189192

docs/source/data-structures/presentations/to-present.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ of type ``List[int]``, then the conversion from one type to another is
7070
:math:`a_i \mapsto` ``human_readable_letter(a_i)``.
7171

7272
This function throws a :any:`LibsemigroupsError` if the type of words in *p* is
73-
not the same as that specified in *Return*, and ``p.validate()`` throws.
73+
not the same as that specified in *Return*, and ``p.throw_if_bad_alphabet_or_rules()`` throws.
7474

7575
.. seealso::
7676

7777
* :any:`words.human_readable_index`;
7878
* :any:`words.human_readable_letter`; and
79-
* :any:`PresentationStrings.validate`.
79+
* :any:`PresentationStrings.throw_if_bad_alphabet_or_rules`.
8080

8181
.. doctest:: Python
8282

@@ -127,13 +127,13 @@ This function returns a :any:`PresentationStrings` equivalent to the input
127127
parameter *f* specifies how to map the letters of one :any:`PresentationStrings`
128128
to the other.
129129

130-
This function throws a :any:`LibsemigroupsError` if ``p.validate()`` throws, or
130+
This function throws a :any:`LibsemigroupsError` if ``p.throw_if_bad_alphabet_or_rules()`` throws, or
131131
if the function specified by *f* does not map letters of the type used in *p* to
132132
letters of the type of word specified in *Return*.
133133

134134
.. seealso::
135135

136-
* :any:`PresentationStrings.validate`.
136+
* :any:`PresentationStrings.throw_if_bad_alphabet_or_rules`.
137137

138138
.. doctest:: Python
139139

@@ -267,4 +267,4 @@ semigroup as *fp*, run ``fp.run()`` (or any other function that fully enumerates
267267
>>> len(p.alphabet()) == 4
268268
True
269269

270-
.. py:class:: Thing(arg)
270+
.. py:class:: Thing(arg)

docs/source/data-structures/tries/class.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Contents
2424
AhoCorasick.number_of_nodes
2525
AhoCorasick.signature
2626
AhoCorasick.suffix_link
27+
AhoCorasick.throw_if_node_index_not_active
28+
AhoCorasick.throw_if_node_index_out_of_range
2729
AhoCorasick.traverse
28-
AhoCorasick.validate_active_node_index
29-
AhoCorasick.validate_node_index
3030

3131
Full API
3232
--------

docs/source/main-algorithms/froidure-pin/froidure-pin.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Contents
4141
FroidurePinPBR.sorted_position
4242
FroidurePinPBR.to_sorted_position
4343

44+
4445
Full API
4546
--------
4647

docs/source/main-algorithms/froidure-pin/to-froidure-pin.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ label of the :any:`WordGraph` the corresponding :math:`f` satisfies
259259
function returns the :any:`FroidurePinPBR` object corresponding to the
260260
semigroup or monoid generated by the set of all such transformations.
261261

262-
This function throws a :any:`LibsemigroupsError` if ``validate`` throws for any
263-
of the constructed generators. This can happen if, for example, the
264-
:any:`WordGraph` is not complete (i.e. there exists an edge label and node for
265-
which there is no edge with the given label and given source) or if there is an
266-
edge label such that
262+
This function throws a :any:`LibsemigroupsError` if
263+
``throw_if_image_value_out_of_range`` throws for any of the constructed
264+
generators. This can happen if, for example, the :any:`WordGraph` is not
265+
complete (i.e. there exists an edge label and node for which there is no edge
266+
with the given label and given source) or if there is an edge label such that
267267
:math:`\{a, \ldots, b - 1\}f \not\subseteq \{a, \ldots, b - 1\}` for the
268268
corresponding :math:`f`.
269269

libsemigroups_pybind11/presentation/__init__.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
"""
1616

1717
from _libsemigroups_pybind11 import (
18-
PresentationStrings as __PresentationStrings,
19-
PresentationWords as __PresentationWords,
18+
# TODO(0) balance?
2019
InversePresentationStrings as __InversePresentationStrings,
2120
InversePresentationWords as __InversePresentationWords,
21+
PresentationStrings as __PresentationStrings,
22+
PresentationWords as __PresentationWords,
2223
add_identity_rules,
2324
add_inverse_rules,
2425
add_rule,
2526
add_rules,
2627
add_zero_rules,
2728
are_rules_sorted,
28-
# TODO(0) balance?
2929
change_alphabet,
3030
contains_rule,
3131
first_unused_letter,
@@ -44,15 +44,15 @@
4444
remove_redundant_generators,
4545
remove_trivial_rules,
4646
replace_subword,
47-
replace_word_with_new_generator,
4847
replace_word,
48+
replace_word_with_new_generator,
4949
reverse,
50-
shortest_rule_length,
5150
shortest_rule,
51+
shortest_rule_length,
5252
sort_each_rule,
5353
sort_rules,
5454
strongly_compress,
55-
validate_semigroup_inverses,
55+
throw_if_bad_inverses,
5656
)
5757

5858
# TODO make these into classes like in transformations
@@ -75,9 +75,7 @@ def Presentation(arg):
7575
"using copy.copy"
7676
)
7777
else:
78-
raise TypeError(
79-
"expected the argument to be a string or a list of ints"
80-
)
78+
raise TypeError("expected the argument to be a string or a list of ints")
8179
return result
8280

8381

@@ -109,9 +107,7 @@ def InversePresentation(arg):
109107
elif isinstance(arg, list) and all(isinstance(x, int) for x in arg):
110108
result = __InversePresentationWords()
111109
result.alphabet(arg)
112-
elif isinstance(
113-
arg, (__InversePresentationStrings, __InversePresentationWords)
114-
):
110+
elif isinstance(arg, (__InversePresentationStrings, __InversePresentationWords)):
115111
raise TypeError(
116112
"expected the argument to be a presentation, a string or a list of "
117113
"ints; received an InversePresentation. If you are trying to copy "

src/aho-corasick.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ This function returns the index of the child of the node with index
102102
:returns: the index of the child.
103103
:rtype: int
104104
105-
:raises LibsemigroupsError: if ``validate_active_node_index(parent)`` throws.
105+
:raises LibsemigroupsError: if ``throw_if_node_index_not_active(parent)`` throws.
106106
107107
:complexity: Constant.
108108
109-
.. seealso:: :any:`validate_active_node_index`.
109+
.. seealso:: :any:`throw_if_node_index_not_active`.
110110
111111
)pbdoc");
112112

@@ -122,11 +122,11 @@ Calculate the height of a node.
122122
:returns: the height.
123123
:rtype: int
124124
125-
:raises LibsemigroupsError: if ``validate_active_node_index(i)`` throws.
125+
:raises LibsemigroupsError: if ``throw_if_node_index_not_active(i)`` throws.
126126
127127
:complexity: Linear in the return value which is, at worst, the maximum length of a word in the trie
128128
129-
.. seealso:: :any:`validate_active_node_index`.
129+
.. seealso:: :any:`throw_if_node_index_not_active`.
130130
131131
)pbdoc");
132132

@@ -195,11 +195,11 @@ the longest proper suffix of :math:`W` contained in the trie.
195195
:returns: The index of the suffix link.
196196
:rtype: int
197197
198-
:raises LibsemigroupsError: if ``validate_active_node_index(current)`` throws.
198+
:raises LibsemigroupsError: if ``throw_if_node_index_not_active(current)`` throws.
199199
200200
:complexity: Linear in the height of the node.
201201
202-
.. seealso:: :any:`validate_active_node_index`.
202+
.. seealso:: :any:`throw_if_node_index_not_active`.
203203
204204
)pbdoc");
205205

@@ -227,32 +227,32 @@ trie.
227227
:returns: The index of the node traversed to
228228
:rtype: int
229229
230-
:raises LibsemigroupsError: if ``validate_active_node_index(current)`` throws.
230+
:raises LibsemigroupsError: if ``throw_if_node_index_not_active(current)`` throws.
231231
232-
.. seealso:: :any:`validate_active_node_index`.
232+
.. seealso:: :any:`throw_if_node_index_not_active`.
233233
234234
)pbdoc");
235235

236-
thing.def("validate_active_node_index",
237-
&AhoCorasick::validate_active_node_index,
236+
thing.def("throw_if_node_index_not_active",
237+
&AhoCorasick::throw_if_node_index_not_active,
238238
py::arg("i"),
239239
R"pbdoc(
240240
Check if an index corresponds to a node currently in the trie.
241241
242242
:param i: the index to validate
243243
:type i: int
244244
245-
:raises LibsemigroupsError: if ``validate_node_index(i)`` throws, or if *i* is
245+
:raises LibsemigroupsError: if ``throw_if_node_index_out_of_range(i)`` throws, or if *i* is
246246
not an active node.
247247
248248
:complexity: Constant
249249
250-
.. seealso:: :any:`validate_node_index`.
250+
.. seealso:: :any:`throw_if_node_index_out_of_range`.
251251
252252
)pbdoc");
253253

254-
thing.def("validate_node_index",
255-
&AhoCorasick::validate_node_index,
254+
thing.def("throw_if_node_index_out_of_range",
255+
&AhoCorasick::throw_if_node_index_out_of_range,
256256
py::arg("i"),
257257
R"pbdoc(
258258
Check if an index corresponds to a node.

0 commit comments

Comments
 (0)