diff --git a/src/cong-common.cpp b/src/cong-common.cpp index 7420166c..590c2206 100644 --- a/src/cong-common.cpp +++ b/src/cong-common.cpp @@ -40,10 +40,10 @@ namespace libsemigroups { namespace py = pybind11; - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; template using MultiView = detail::MultiView; @@ -54,10 +54,10 @@ namespace libsemigroups { using KnuthBendixWordLenLexTrie = KnuthBendix; using KnuthBendixWordLenLexSet = KnuthBendix; - using KnuthBendixStringRPOTrie = KnuthBendix; - using KnuthBendixStringRPOSet = KnuthBendix; - using KnuthBendixWordRPOTrie = KnuthBendix; - using KnuthBendixWordRPOSet = KnuthBendix; + using KnuthBendixStringRevRPOTrie = KnuthBendix; + using KnuthBendixStringRevRPOSet = KnuthBendix; + using KnuthBendixWordRevRPOTrie = KnuthBendix; + using KnuthBendixWordRevRPOSet = KnuthBendix; //////////////////////////////////////////////////////////////////////// // Implementation helpers @@ -138,9 +138,9 @@ This function default constructs an uninitialised :any:`{name}` instance. DEF_CONSTRUCT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONSTRUCT_DEFAULT(detail::KnuthBendixImpl, + DEF_CONSTRUCT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONSTRUCT_DEFAULT(detail::KnuthBendixImpl, + DEF_CONSTRUCT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); DEF_CONSTRUCT_DEFAULT(KnuthBendixStringLenLexTrie, @@ -152,13 +152,14 @@ This function default constructs an uninitialised :any:`{name}` instance. DEF_CONSTRUCT_DEFAULT(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_CONSTRUCT_DEFAULT(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_DEFAULT(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_DEFAULT(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_DEFAULT(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_CONSTRUCT_DEFAULT(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_DEFAULT(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_DEFAULT(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_DEFAULT(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_CONSTRUCT_DEFAULT(Congruence, detail::CongruenceCommon); DEF_CONSTRUCT_DEFAULT(Congruence, detail::CongruenceCommon); @@ -211,8 +212,10 @@ have been in if it had just been newly default constructed. DEF_INIT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_INIT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_INIT_DEFAULT(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_INIT_DEFAULT(detail::KnuthBendixImpl, + detail::CongruenceCommon); + DEF_INIT_DEFAULT(detail::KnuthBendixImpl, + detail::CongruenceCommon); DEF_INIT_DEFAULT(KnuthBendixStringLenLexTrie, detail::KnuthBendixImpl); @@ -223,10 +226,14 @@ have been in if it had just been newly default constructed. DEF_INIT_DEFAULT(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_INIT_DEFAULT(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_INIT_DEFAULT(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_INIT_DEFAULT(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_INIT_DEFAULT(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_INIT_DEFAULT(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_INIT_DEFAULT(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_INIT_DEFAULT(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_INIT_DEFAULT(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_INIT_DEFAULT(Congruence, detail::CongruenceCommon); DEF_INIT_DEFAULT(Congruence, detail::CongruenceCommon); @@ -302,19 +309,19 @@ of kind *knd* over the semigroup or monoid defined by the presentation *p*. DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_CONSTRUCT_KIND_PRESENTATION(detail::KnuthBendixImpl, + DEF_CONSTRUCT_KIND_PRESENTATION(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONSTRUCT_KIND_PRESENTATION(detail::KnuthBendixImpl, + DEF_CONSTRUCT_KIND_PRESENTATION(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixWordRPOSet, - detail::KnuthBendixImpl); + DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CONSTRUCT_KIND_PRESENTATION(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_CONSTRUCT_KIND_PRESENTATION(Congruence, detail::CongruenceCommon); @@ -393,19 +400,19 @@ had been newly constructed from *knd* and *p*. DEF_INIT_KIND_PRESENTATION(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_INIT_KIND_PRESENTATION(detail::KnuthBendixImpl, + DEF_INIT_KIND_PRESENTATION(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_INIT_KIND_PRESENTATION(detail::KnuthBendixImpl, + DEF_INIT_KIND_PRESENTATION(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_INIT_KIND_PRESENTATION(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_INIT_KIND_PRESENTATION(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_INIT_KIND_PRESENTATION(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_INIT_KIND_PRESENTATION(KnuthBendixWordRPOSet, - detail::KnuthBendixImpl); + DEF_INIT_KIND_PRESENTATION(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_INIT_KIND_PRESENTATION(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_INIT_KIND_PRESENTATION(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_INIT_KIND_PRESENTATION(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_INIT_KIND_PRESENTATION(Congruence, detail::CongruenceCommon); DEF_INIT_KIND_PRESENTATION(Congruence, detail::CongruenceCommon); @@ -458,13 +465,13 @@ Copy a :any:`{name}` object. DEF_COPY(KnuthBendixWordLenLexTrie, detail::KnuthBendixImpl); DEF_COPY(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_COPY(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_COPY(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_COPY(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_COPY(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_COPY(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_COPY(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_COPY(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_COPY(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_COPY(KnuthBendixStringRevRPOTrie, detail::KnuthBendixImpl); + DEF_COPY(KnuthBendixStringRevRPOSet, detail::KnuthBendixImpl); + DEF_COPY(KnuthBendixWordRevRPOTrie, detail::KnuthBendixImpl); + DEF_COPY(KnuthBendixWordRevRPOSet, detail::KnuthBendixImpl); DEF_COPY(Congruence, detail::CongruenceCommon); DEF_COPY(Congruence, detail::CongruenceCommon); @@ -522,9 +529,9 @@ number of classes in the congruence represented by a :any:`{name}` instance. DEF_NUMBER_OF_CLASSES(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_NUMBER_OF_CLASSES(detail::KnuthBendixImpl, + DEF_NUMBER_OF_CLASSES(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_NUMBER_OF_CLASSES(detail::KnuthBendixImpl, + DEF_NUMBER_OF_CLASSES(detail::KnuthBendixImpl, detail::CongruenceCommon); DEF_NUMBER_OF_CLASSES(Congruence, detail::CongruenceCommon); @@ -610,19 +617,19 @@ This function adds a generating pair to the congruence represented by a DEF_ADD_GENERATING_PAIR(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_ADD_GENERATING_PAIR(detail::KnuthBendixImpl, + DEF_ADD_GENERATING_PAIR(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_ADD_GENERATING_PAIR(detail::KnuthBendixImpl, + DEF_ADD_GENERATING_PAIR(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_ADD_GENERATING_PAIR(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_ADD_GENERATING_PAIR(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_ADD_GENERATING_PAIR(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_ADD_GENERATING_PAIR(KnuthBendixWordRPOSet, - detail::KnuthBendixImpl); + DEF_ADD_GENERATING_PAIR(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_ADD_GENERATING_PAIR(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_ADD_GENERATING_PAIR(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_ADD_GENERATING_PAIR(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_ADD_GENERATING_PAIR(Congruence, detail::CongruenceCommon); DEF_ADD_GENERATING_PAIR(Congruence, detail::CongruenceCommon); @@ -707,19 +714,19 @@ contained in the congruence, but that this is not currently known. DEF_CURRENTLY_CONTAINS(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_CURRENTLY_CONTAINS(detail::KnuthBendixImpl, + DEF_CURRENTLY_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CURRENTLY_CONTAINS(detail::KnuthBendixImpl, + DEF_CURRENTLY_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CURRENTLY_CONTAINS(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_CURRENTLY_CONTAINS(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_CURRENTLY_CONTAINS(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_CURRENTLY_CONTAINS(KnuthBendixWordRPOSet, - detail::KnuthBendixImpl); + DEF_CURRENTLY_CONTAINS(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CURRENTLY_CONTAINS(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_CURRENTLY_CONTAINS(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CURRENTLY_CONTAINS(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_CURRENTLY_CONTAINS(Congruence, detail::CongruenceCommon); DEF_CURRENTLY_CONTAINS(Congruence, detail::CongruenceCommon); @@ -792,13 +799,14 @@ congruence represented by a :py:class:`{name}` instance. DEF_CONTAINS(KnuthBendixWordLenLexTrie, detail::KnuthBendixImpl); DEF_CONTAINS(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_CONTAINS(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_CONTAINS(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_CONTAINS(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_CONTAINS(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_CONTAINS(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_CONTAINS(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_CONTAINS(KnuthBendixStringRevRPOSet, detail::KnuthBendixImpl); + DEF_CONTAINS(KnuthBendixWordRevRPOTrie, detail::KnuthBendixImpl); + DEF_CONTAINS(KnuthBendixWordRevRPOSet, detail::KnuthBendixImpl); DEF_CONTAINS(Congruence, detail::CongruenceCommon); DEF_CONTAINS(Congruence, detail::CongruenceCommon); @@ -873,13 +881,19 @@ normal form for the input word *w*. DEF_REDUCE_NO_RUN(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_REDUCE_NO_RUN(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_REDUCE_NO_RUN(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_REDUCE_NO_RUN(detail::KnuthBendixImpl, + detail::CongruenceCommon); + DEF_REDUCE_NO_RUN(detail::KnuthBendixImpl, + detail::CongruenceCommon); - DEF_REDUCE_NO_RUN(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_REDUCE_NO_RUN(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_REDUCE_NO_RUN(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_REDUCE_NO_RUN(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_REDUCE_NO_RUN(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_REDUCE_NO_RUN(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_REDUCE_NO_RUN(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_REDUCE_NO_RUN(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_REDUCE_NO_RUN(Congruence, detail::CongruenceCommon); DEF_REDUCE_NO_RUN(Congruence, detail::CongruenceCommon); @@ -949,13 +963,13 @@ input word. DEF_REDUCE(KnuthBendixWordLenLexTrie, detail::KnuthBendixImpl); DEF_REDUCE(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_REDUCE(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_REDUCE(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_REDUCE(detail::KnuthBendixImpl, detail::CongruenceCommon); + DEF_REDUCE(detail::KnuthBendixImpl, detail::CongruenceCommon); - DEF_REDUCE(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_REDUCE(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_REDUCE(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_REDUCE(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_REDUCE(KnuthBendixStringRevRPOTrie, detail::KnuthBendixImpl); + DEF_REDUCE(KnuthBendixStringRevRPOSet, detail::KnuthBendixImpl); + DEF_REDUCE(KnuthBendixWordRevRPOTrie, detail::KnuthBendixImpl); + DEF_REDUCE(KnuthBendixWordRevRPOSet, detail::KnuthBendixImpl); DEF_REDUCE(Congruence, detail::CongruenceCommon); DEF_REDUCE(Congruence, detail::CongruenceCommon); @@ -1015,13 +1029,14 @@ This function returns the generating pairs of the congruence as added via DEF_GENERATING_PAIRS(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_GENERATING_PAIRS(KnuthBendixStringRPOTrie, - detail::KnuthBendixImpl); - DEF_GENERATING_PAIRS(KnuthBendixStringRPOSet, - detail::KnuthBendixImpl); - DEF_GENERATING_PAIRS(KnuthBendixWordRPOTrie, - detail::KnuthBendixImpl); - DEF_GENERATING_PAIRS(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_GENERATING_PAIRS(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_GENERATING_PAIRS(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_GENERATING_PAIRS(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_GENERATING_PAIRS(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_GENERATING_PAIRS(Congruence, detail::CongruenceCommon); DEF_GENERATING_PAIRS(Congruence, detail::CongruenceCommon); @@ -1082,10 +1097,14 @@ presentation, then this presentation is returned by this function. DEF_PRESENTATION(KnuthBendixWordLenLexSet, detail::KnuthBendixImpl); - DEF_PRESENTATION(KnuthBendixStringRPOTrie, detail::KnuthBendixImpl); - DEF_PRESENTATION(KnuthBendixStringRPOSet, detail::KnuthBendixImpl); - DEF_PRESENTATION(KnuthBendixWordRPOTrie, detail::KnuthBendixImpl); - DEF_PRESENTATION(KnuthBendixWordRPOSet, detail::KnuthBendixImpl); + DEF_PRESENTATION(KnuthBendixStringRevRPOTrie, + detail::KnuthBendixImpl); + DEF_PRESENTATION(KnuthBendixStringRevRPOSet, + detail::KnuthBendixImpl); + DEF_PRESENTATION(KnuthBendixWordRevRPOTrie, + detail::KnuthBendixImpl); + DEF_PRESENTATION(KnuthBendixWordRevRPOSet, + detail::KnuthBendixImpl); DEF_PRESENTATION(Congruence, detail::CongruenceCommon); DEF_PRESENTATION(Congruence, detail::CongruenceCommon); @@ -1155,10 +1174,10 @@ triggers a full enumeration of *{var}*. DEF_PARTITION(KnuthBendixWordLenLexTrie); DEF_PARTITION(KnuthBendixWordLenLexSet); - DEF_PARTITION(KnuthBendixStringRPOTrie); - DEF_PARTITION(KnuthBendixStringRPOSet); - DEF_PARTITION(KnuthBendixWordRPOTrie); - DEF_PARTITION(KnuthBendixWordRPOSet); + DEF_PARTITION(KnuthBendixStringRevRPOTrie); + DEF_PARTITION(KnuthBendixStringRevRPOSet); + DEF_PARTITION(KnuthBendixWordRevRPOTrie); + DEF_PARTITION(KnuthBendixWordRevRPOSet); DEF_PARTITION(Congruence); DEF_PARTITION(Congruence); @@ -1227,10 +1246,10 @@ instance *{var}*. DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordLenLexTrie); DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordLenLexSet); - DEF_NON_TRIVIAL_CLASSES(KnuthBendixStringRPOTrie); - DEF_NON_TRIVIAL_CLASSES(KnuthBendixStringRPOSet); - DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordRPOTrie); - DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordRPOSet); + DEF_NON_TRIVIAL_CLASSES(KnuthBendixStringRevRPOTrie); + DEF_NON_TRIVIAL_CLASSES(KnuthBendixStringRevRPOSet); + DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordRevRPOTrie); + DEF_NON_TRIVIAL_CLASSES(KnuthBendixWordRevRPOSet); DEF_NON_TRIVIAL_CLASSES(Congruence); DEF_NON_TRIVIAL_CLASSES(Congruence); @@ -1295,10 +1314,10 @@ the congruence represented by an instance of :any:`{name}`. DEF_NORMAL_FORMS(KnuthBendixWordLenLexTrie); DEF_NORMAL_FORMS(KnuthBendixWordLenLexSet); - DEF_NORMAL_FORMS(KnuthBendixStringRPOTrie); - DEF_NORMAL_FORMS(KnuthBendixStringRPOSet); - DEF_NORMAL_FORMS(KnuthBendixWordRPOTrie); - DEF_NORMAL_FORMS(KnuthBendixWordRPOSet); + DEF_NORMAL_FORMS(KnuthBendixStringRevRPOTrie); + DEF_NORMAL_FORMS(KnuthBendixStringRevRPOSet); + DEF_NORMAL_FORMS(KnuthBendixWordRevRPOTrie); + DEF_NORMAL_FORMS(KnuthBendixWordRevRPOSet); // TODO(1) uncomment when implemented in libsemigroups // DEF_NORMAL_FORMS(Congruence); diff --git a/src/froidure-pin.cpp b/src/froidure-pin.cpp index 47122eb3..eaf8cccf 100644 --- a/src/froidure-pin.cpp +++ b/src/froidure-pin.cpp @@ -1272,10 +1272,10 @@ This function returns the element of *fp* obtained by evaluating *w*. } // namespace void init_froidure_pin(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; bind_froidure_pin_stateless>(m, "Transf1"); bind_froidure_pin_stateless>(m, "Transf2"); @@ -1316,14 +1316,16 @@ This function returns the element of *fp* obtained by evaluating *w*. bind_froidure_pin_stateful>>( m, "KBEWordLenLexTrie"); - bind_froidure_pin_stateful>>( - m, "KBEStringRPOSet"); - bind_froidure_pin_stateful>>( - m, "KBEStringRPOTrie"); - bind_froidure_pin_stateful>>( - m, "KBEWordRPOSet"); - bind_froidure_pin_stateful>>( - m, "KBEWordRPOTrie"); + bind_froidure_pin_stateful< + detail::KBE>>(m, + "KBEStringRevRPOSet"); + bind_froidure_pin_stateful< + detail::KBE>>( + m, "KBEStringRevRPOTrie"); + bind_froidure_pin_stateful>>( + m, "KBEWordRevRPOSet"); + bind_froidure_pin_stateful>>( + m, "KBEWordRevRPOTrie"); bind_froidure_pin_stateful>(m, "KEString"); bind_froidure_pin_stateful>>( diff --git a/src/kbe.cpp b/src/kbe.cpp index 96db52e6..19065bbb 100644 --- a/src/kbe.cpp +++ b/src/kbe.cpp @@ -73,10 +73,10 @@ namespace libsemigroups { } void init_kbe(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; // LenLex using KBEStringLenLexTrie @@ -91,14 +91,15 @@ namespace libsemigroups { bind_kbe(m, "KBEWordLenLexSet"); // RPO - using KBEStringRPOTrie = detail::KBE>; - using KBEWordRPOTrie = detail::KBE>; - using KBEStringRPOSet = detail::KBE>; - using KBEWordRPOSet = detail::KBE>; - - bind_kbe(m, "KBEStringRPOTrie"); - bind_kbe(m, "KBEWordRPOTrie"); - bind_kbe(m, "KBEStringRPOSet"); - bind_kbe(m, "KBEWordRPOSet"); + using KBEStringRevRPOTrie + = detail::KBE>; + using KBEWordRevRPOTrie = detail::KBE>; + using KBEStringRevRPOSet = detail::KBE>; + using KBEWordRevRPOSet = detail::KBE>; + + bind_kbe(m, "KBEStringRevRPOTrie"); + bind_kbe(m, "KBEWordRevRPOTrie"); + bind_kbe(m, "KBEStringRevRPOSet"); + bind_kbe(m, "KBEWordRevRPOSet"); } } // namespace libsemigroups diff --git a/src/knuth-bendix-impl.cpp b/src/knuth-bendix-impl.cpp index f93bcf04..c4a04b8a 100644 --- a/src/knuth-bendix-impl.cpp +++ b/src/knuth-bendix-impl.cpp @@ -16,7 +16,6 @@ // // TODO(1) this file is not organised like any other: -// * kb should be called thing // * we don't chain the "def"s in the other files (easier to wrangle) // C std headers.... @@ -507,17 +506,19 @@ infinite; ``False`` is returned if it is not. } // namespace detail void init_detail_knuth_bendix_impl(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; detail::bind_detail_knuth_bendix_impl( m, "KnuthBendixImplLenLexSet"); detail::bind_detail_knuth_bendix_impl( m, "KnuthBendixImplLenLexTrie"); - detail::bind_detail_knuth_bendix_impl(m, "KnuthBendixImplRPOSet"); - detail::bind_detail_knuth_bendix_impl(m, "KnuthBendixImplRPOTrie"); + detail::bind_detail_knuth_bendix_impl( + m, "KnuthBendixImplRevRPOSet"); + detail::bind_detail_knuth_bendix_impl( + m, "KnuthBendixImplRevRPOTrie"); } } // namespace libsemigroups diff --git a/src/knuth-bendix.cpp b/src/knuth-bendix.cpp index b4921330..d5cce759 100644 --- a/src/knuth-bendix.cpp +++ b/src/knuth-bendix.cpp @@ -331,10 +331,8 @@ Check if all rules are reduced with respect to each other. template void bind_normal_form_range(py::module& m, char const* name) { - using NormalFormRange = detail::KnuthBendixNormalFormRange< - Word, - Rewriter, - typename Rewriter::reduction_order>; + using NormalFormRange + = detail::KnuthBendixNormalFormRange; py::class_ thing(m, name); thing.def("__repr__", [](NormalFormRange const& nfr) { @@ -451,10 +449,10 @@ redundant in this way, then ``None`` is returned. } void init_knuth_bendix(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; bind_knuth_bendix(m, "KnuthBendixWordLenLexTrie"); bind_knuth_bendix(m, "KnuthBendixWordLenLexSet"); @@ -462,10 +460,11 @@ redundant in this way, then ``None`` is returned. "KnuthBendixStringLenLexTrie"); bind_knuth_bendix(m, "KnuthBendixStringLenLexSet"); - bind_knuth_bendix(m, "KnuthBendixWordRPOTrie"); - bind_knuth_bendix(m, "KnuthBendixWordRPOSet"); - bind_knuth_bendix(m, "KnuthBendixStringRPOTrie"); - bind_knuth_bendix(m, "KnuthBendixStringRPOSet"); + bind_knuth_bendix(m, "KnuthBendixWordRevRPOTrie"); + bind_knuth_bendix(m, "KnuthBendixWordRevRPOSet"); + bind_knuth_bendix(m, + "KnuthBendixStringRevRPOTrie"); + bind_knuth_bendix(m, "KnuthBendixStringRevRPOSet"); bind_normal_form_range( m, "KnuthBendixNormalFormRangeWordLenLexTrie"); @@ -476,14 +475,14 @@ redundant in this way, then ``None`` is returned. bind_normal_form_range( m, "KnuthBendixNormalFormRangeStringLenLexSet"); - bind_normal_form_range( - m, "KnuthBendixNormalFormRangeWordRPOTrie"); - bind_normal_form_range( - m, "KnuthBendixNormalFormRangeWordRPOSet"); - bind_normal_form_range( - m, "KnuthBendixNormalFormRangeStringRPOTrie"); - bind_normal_form_range( - m, "KnuthBendixNormalFormRangeStringRPOSet"); + bind_normal_form_range( + m, "KnuthBendixNormalFormRangeWordRevRPOTrie"); + bind_normal_form_range( + m, "KnuthBendixNormalFormRangeWordRevRPOSet"); + bind_normal_form_range( + m, "KnuthBendixNormalFormRangeStringRevRPOTrie"); + bind_normal_form_range( + m, "KnuthBendixNormalFormRangeStringRevRPOSet"); bind_redundant_rule(m); bind_redundant_rule(m); diff --git a/src/libsemigroups_pybind11/__init__.py b/src/libsemigroups_pybind11/__init__.py index d75c4998..4d15bbd4 100644 --- a/src/libsemigroups_pybind11/__init__.py +++ b/src/libsemigroups_pybind11/__init__.py @@ -41,6 +41,7 @@ from .bipartition import Bipartition from .blocks import Blocks from .congruence import Congruence +from .detail.cxx_wrapper import wrap_cxx_free_fn as _wrap_cxx_free_fn from .detail.dot import Dot from .forest import PathsFromRoots, PathsToRoots from .froidure_pin import FroidurePin @@ -103,12 +104,16 @@ delta, error_message_with_prefix, freeband_equal_to, + lenlex_cmp as _lenlex_cmp, + lex_cmp as _lex_cmp, lexicographical_compare, number_of_words, random_string, random_strings, random_word, recursive_path_compare, + rev_rpo_cmp as _rev_rpo_cmp, + rpo_cmp as _rpo_cmp, shortlex_compare, side, tril, @@ -120,6 +125,12 @@ ) from e +lenlex_cmp = _wrap_cxx_free_fn(_lenlex_cmp) +lex_cmp = _wrap_cxx_free_fn(_lex_cmp) +rev_rpo_cmp = _wrap_cxx_free_fn(_rev_rpo_cmp) +rpo_cmp = _wrap_cxx_free_fn(_rpo_cmp) + + __all__ = [ "__version__", # Constants from _libsemigruops_pybind11 @@ -158,12 +169,16 @@ "delta", "error_message_with_prefix", "freeband_equal_to", + "lenlex_cmp", + "lex_cmp", "lexicographical_compare", "number_of_words", "random_string", "random_strings", "random_word", "recursive_path_compare", + "rev_rpo_cmp", + "rpo_cmp", "shortlex_compare", "side", "tril", diff --git a/src/libsemigroups_pybind11/froidure_pin.py b/src/libsemigroups_pybind11/froidure_pin.py index d892be0f..baa206e5 100644 --- a/src/libsemigroups_pybind11/froidure_pin.py +++ b/src/libsemigroups_pybind11/froidure_pin.py @@ -28,12 +28,12 @@ FroidurePinIntMat as _FroidurePinIntMat, FroidurePinKBEStringLenLexSet as _FroidurePinKBEStringLenLexSet, FroidurePinKBEStringLenLexTrie as _FroidurePinKBEStringLenLexTrie, - FroidurePinKBEStringRPOSet as _FroidurePinKBEStringRPOSet, - FroidurePinKBEStringRPOTrie as _FroidurePinKBEStringRPOTrie, + FroidurePinKBEStringRevRPOSet as _FroidurePinKBEStringRevRPOSet, + FroidurePinKBEStringRevRPOTrie as _FroidurePinKBEStringRevRPOTrie, FroidurePinKBEWordLenLexSet as _FroidurePinKBEWordLenLexSet, FroidurePinKBEWordLenLexTrie as _FroidurePinKBEWordLenLexTrie, - FroidurePinKBEWordRPOSet as _FroidurePinKBEWordRPOSet, - FroidurePinKBEWordRPOTrie as _FroidurePinKBEWordRPOTrie, + FroidurePinKBEWordRevRPOSet as _FroidurePinKBEWordRevRPOSet, + FroidurePinKBEWordRevRPOTrie as _FroidurePinKBEWordRevRPOTrie, FroidurePinKEMultiViewString as _FroidurePinKEMultiViewString, FroidurePinKEString as _FroidurePinKEString, FroidurePinKEWord as _FroidurePinKEWord, @@ -57,12 +57,12 @@ IntMat as _IntMat, KBEStringLenLexSet as _KBEStringLenLexSet, KBEStringLenLexTrie as _KBEStringLenLexTrie, - KBEStringRPOSet as _KBEStringRPOSet, - KBEStringRPOTrie as _KBEStringRPOTrie, + KBEStringRevRPOSet as _KBEStringRevRPOSet, + KBEStringRevRPOTrie as _KBEStringRevRPOTrie, KBEWordLenLexSet as _KBEWordLenLexSet, KBEWordLenLexTrie as _KBEWordLenLexTrie, - KBEWordRPOSet as _KBEWordRPOSet, - KBEWordRPOTrie as _KBEWordRPOTrie, + KBEWordRevRPOSet as _KBEWordRevRPOSet, + KBEWordRevRPOTrie as _KBEWordRevRPOTrie, MaxPlusMat as _MaxPlusMat, MaxPlusTruncMat as _MaxPlusTruncMat, MinPlusMat as _MinPlusMat, @@ -157,10 +157,10 @@ class FroidurePin(_CxxWrapper): (_KBEStringLenLexSet,): _FroidurePinKBEStringLenLexSet, (_KBEWordLenLexTrie,): _FroidurePinKBEWordLenLexTrie, (_KBEWordLenLexSet,): _FroidurePinKBEWordLenLexSet, - (_KBEStringRPOTrie,): _FroidurePinKBEStringRPOTrie, - (_KBEStringRPOSet,): _FroidurePinKBEStringRPOSet, - (_KBEWordRPOTrie,): _FroidurePinKBEWordRPOTrie, - (_KBEWordRPOSet,): _FroidurePinKBEWordRPOSet, + (_KBEStringRevRPOTrie,): _FroidurePinKBEStringRevRPOTrie, + (_KBEStringRevRPOSet,): _FroidurePinKBEStringRevRPOSet, + (_KBEWordRevRPOTrie,): _FroidurePinKBEWordRevRPOTrie, + (_KBEWordRevRPOSet,): _FroidurePinKBEWordRevRPOSet, } | ( { (_HPCombiPTransf16,): _FroidurePinHPCombiPTransf16, diff --git a/src/libsemigroups_pybind11/knuth_bendix.py b/src/libsemigroups_pybind11/knuth_bendix.py index 856835dc..b187bbba 100644 --- a/src/libsemigroups_pybind11/knuth_bendix.py +++ b/src/libsemigroups_pybind11/knuth_bendix.py @@ -14,12 +14,12 @@ from _libsemigroups_pybind11 import ( KnuthBendixStringLenLexSet as _KnuthBendixStringLenLexSet, KnuthBendixStringLenLexTrie as _KnuthBendixStringLenLexTrie, - KnuthBendixStringRPOSet as _KnuthBendixStringRPOSet, - KnuthBendixStringRPOTrie as _KnuthBendixStringRPOTrie, + KnuthBendixStringRevRPOSet as _KnuthBendixStringRevRPOSet, + KnuthBendixStringRevRPOTrie as _KnuthBendixStringRevRPOTrie, KnuthBendixWordLenLexSet as _KnuthBendixWordLenLexSet, KnuthBendixWordLenLexTrie as _KnuthBendixWordLenLexTrie, - KnuthBendixWordRPOSet as _KnuthBendixWordRPOSet, - KnuthBendixWordRPOTrie as _KnuthBendixWordRPOTrie, + KnuthBendixWordRevRPOSet as _KnuthBendixWordRevRPOSet, + KnuthBendixWordRevRPOTrie as _KnuthBendixWordRevRPOTrie, Order as _Order, knuth_bendix_by_overlap_length as _knuth_bendix_by_overlap_length, knuth_bendix_is_reduced as _knuth_bendix_is_reduced, @@ -54,10 +54,10 @@ class KnuthBendix(_CongruenceCommon): (str, "Trie", _Order.shortlex): _KnuthBendixStringLenLexTrie, (list[int], "Set", _Order.shortlex): _KnuthBendixWordLenLexSet, (str, "Set", _Order.shortlex): _KnuthBendixStringLenLexSet, - (list[int], "Trie", _Order.recursive): _KnuthBendixWordRPOTrie, - (str, "Trie", _Order.recursive): _KnuthBendixStringRPOTrie, - (list[int], "Set", _Order.recursive): _KnuthBendixWordRPOSet, - (str, "Set", _Order.recursive): _KnuthBendixStringRPOSet, + (list[int], "Trie", _Order.recursive): _KnuthBendixWordRevRPOTrie, + (str, "Trie", _Order.recursive): _KnuthBendixStringRevRPOTrie, + (list[int], "Set", _Order.recursive): _KnuthBendixWordRevRPOSet, + (str, "Set", _Order.recursive): _KnuthBendixStringRevRPOSet, } _cxx_type_to_py_template_params = dict( diff --git a/src/libsemigroups_pybind11/to.py b/src/libsemigroups_pybind11/to.py index f195a4c7..82944b28 100644 --- a/src/libsemigroups_pybind11/to.py +++ b/src/libsemigroups_pybind11/to.py @@ -23,16 +23,16 @@ to_knuth_bendix as _to_knuth_bendix, to_knuth_bendix_LenLexSet as _to_knuth_bendix_LenLexSet, to_knuth_bendix_LenLexTrie as _to_knuth_bendix_LenLexTrie, - to_knuth_bendix_RPOSet as _to_knuth_bendix_RPOSet, - to_knuth_bendix_RPOTrie as _to_knuth_bendix_RPOTrie, + to_knuth_bendix_RevRPOSet as _to_knuth_bendix_RevRPOSet, + to_knuth_bendix_RevRPOTrie as _to_knuth_bendix_RevRPOTrie, to_knuth_bendix_string_LenLexSet as _to_knuth_bendix_string_LenLexSet, to_knuth_bendix_string_LenLexTrie as _to_knuth_bendix_string_LenLexTrie, - to_knuth_bendix_string_RPOSet as _to_knuth_bendix_string_RPOSet, - to_knuth_bendix_string_RPOTrie as _to_knuth_bendix_string_RPOTrie, + to_knuth_bendix_string_RevRPOSet as _to_knuth_bendix_string_RevRPOSet, + to_knuth_bendix_string_RevRPOTrie as _to_knuth_bendix_string_RevRPOTrie, to_knuth_bendix_word_LenLexSet as _to_knuth_bendix_word_LenLexSet, to_knuth_bendix_word_LenLexTrie as _to_knuth_bendix_word_LenLexTrie, - to_knuth_bendix_word_RPOSet as _to_knuth_bendix_word_RPOSet, - to_knuth_bendix_word_RPOTrie as _to_knuth_bendix_word_RPOTrie, + to_knuth_bendix_word_RevRPOSet as _to_knuth_bendix_word_RevRPOSet, + to_knuth_bendix_word_RevRPOTrie as _to_knuth_bendix_word_RevRPOTrie, to_presentation as _to_presentation, to_presentation_string as _to_presentation_string, to_presentation_word as _to_presentation_word, @@ -88,12 +88,12 @@ def _nice_name(type_list): (_KnuthBendix, list[int], "Trie", _Order.shortlex): _to_knuth_bendix_word_LenLexTrie, (_KnuthBendix, str, "Set", _Order.shortlex): _to_knuth_bendix_string_LenLexSet, (_KnuthBendix, str, "Trie", _Order.shortlex): _to_knuth_bendix_string_LenLexTrie, - (_KnuthBendix, "Set", _Order.recursive): _to_knuth_bendix_RPOSet, - (_KnuthBendix, "Trie", _Order.recursive): _to_knuth_bendix_RPOTrie, - (_KnuthBendix, list[int], "Set", _Order.recursive): _to_knuth_bendix_word_RPOSet, - (_KnuthBendix, list[int], "Trie", _Order.recursive): _to_knuth_bendix_word_RPOTrie, - (_KnuthBendix, str, "Set", _Order.recursive): _to_knuth_bendix_string_RPOSet, - (_KnuthBendix, str, "Trie", _Order.recursive): _to_knuth_bendix_string_RPOTrie, + (_KnuthBendix, "Set", _Order.recursive): _to_knuth_bendix_RevRPOSet, + (_KnuthBendix, "Trie", _Order.recursive): _to_knuth_bendix_RevRPOTrie, + (_KnuthBendix, list[int], "Set", _Order.recursive): _to_knuth_bendix_word_RevRPOSet, + (_KnuthBendix, list[int], "Trie", _Order.recursive): _to_knuth_bendix_word_RevRPOTrie, + (_KnuthBendix, str, "Set", _Order.recursive): _to_knuth_bendix_string_RevRPOSet, + (_KnuthBendix, str, "Trie", _Order.recursive): _to_knuth_bendix_string_RevRPOTrie, (_Presentation,): _to_presentation, (_Presentation, str): _to_presentation_string, (_Presentation, list[int]): _to_presentation_word, diff --git a/src/main.cpp b/src/main.cpp index c67bbdcf..fd5c9afb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,6 +68,9 @@ namespace libsemigroups { // Must be before most things init_constants(m); + // The alphabet-aware order comparison overloads require the Alphabet + // classes to be registered before their signatures are created. + init_alphabet(m); init_order(m); init_types(m); @@ -76,7 +79,6 @@ namespace libsemigroups { init_runner(m); // Must be before cong classes - init_alphabet(m); init_present(m); init_inverse_present(m); diff --git a/src/order.cpp b/src/order.cpp index 94d10852..7e9e0c53 100644 --- a/src/order.cpp +++ b/src/order.cpp @@ -1,6 +1,6 @@ // // libsemigroups_pybind11 -// Copyright (C) 2023-2024 Murray T. Whyte +// Copyright (C) 2023-2026 Murray T. Whyte // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -16,195 +16,256 @@ // along with this program. If not, see . // -// C std headers.... - // C++ stl headers.... +#include // for string // libsemigroups.... -#include // for order -#include // for order +#include // for *_cmp, Order +#include // for word_type // pybind11.... -#include // for class_, make_iterator, init, enum_ -#include +#include // for arg, enum_, module, options +#include // for automatic conversions // libsemigroups_pybind11.... -#include "main.hpp" // for init_paths +#include "main.hpp" // for init_order namespace libsemigroups { namespace py = pybind11; - void init_order(py::module& m) { - py::options options; - options.disable_enum_members_docstring(); - - py::enum_(m, "Order", R"pbdoc( -An enum class for the possible orderings of words and strings. - -The values in this enum can be used as the arguments for functions such as -:any:`ToddCoxeter.standardize` or :any:`WordRange.order` to specify which -ordering should be used. The normal forms for congruence classes are given with -respect to one of the orders specified by the values in this enum. - -The valid values are: - -.. py:attribute:: Order.none - :value: - - No ordering + namespace { + void warn_deprecated(char const* old_name, char const* new_name) { + std::string message = old_name; + message += " is deprecated, and will be removed from " + "libsemigroups_pybind11 in v2. Instead, use "; + message += new_name; + message += "."; + if (PyErr_WarnEx(PyExc_DeprecationWarning, message.c_str(), 2) < 0) { + throw py::error_already_set(); + } + } + + template + void bind_compare(py::module& m, + char const* name, + Compare compare, + AlphabetCompare alphabet_compare, + char const* doc) { + m.def( + name, + [compare](Word const& x, Word const& y) { return compare(x, y); }, + py::arg("x"), + py::arg("y"), + doc); + m.def( + name, + [alphabet_compare]( + Alphabet const& alphabet, Word const& x, Word const& y) { + return alphabet_compare(alphabet, x, y); + }, + py::arg("alphabet"), + py::arg("x"), + py::arg("y"), + doc); + } + + template + void bind_deprecated_compare(py::module& m, + char const* old_name, + char const* new_name, + Compare compare, + char const* doc) { + m.def( + old_name, + [old_name, new_name, compare](Word const& x, Word const& y) { + warn_deprecated(old_name, new_name); + return compare(x, y); + }, + py::arg("x"), + py::arg("y"), + doc); + } + + template + void bind_order_comparisons(py::module& m) { + bind_compare( + m, + "lex_cmp", + [](Word const& x, Word const& y) { return lex_cmp(x, y); }, + [](Alphabet const& alphabet, Word const& x, Word const& y) { + return lex_cmp(alphabet, x, y); + }, + R"pbdoc( +:sig=(x: str | list[int], y: str | list[int]) -> bool: +:only-document-once: +Compare two words lexicographically. -.. py:attribute:: Order.shortlex - :value: +The three-argument overload ``lex_cmp(alphabet, x, y)`` compares letters by +their positions in *alphabet*. It raises :any:`LibsemigroupsError` if either +word contains a letter that does not belong to *alphabet*. - The short-lex ordering. Words are first ordered by length, and then - lexicographically. +:param x: the first word. +:type x: str | list[int] +:param y: the second word. +:type y: str | list[int] +:returns: Whether *x* is less than *y*. +:rtype: bool +)pbdoc"); -.. py:attribute:: Order.lex - :value: + bind_compare( + m, + "lenlex_cmp", + [](Word const& x, Word const& y) { return lenlex_cmp(x, y); }, + [](Alphabet const& alphabet, Word const& x, Word const& y) { + return lenlex_cmp(alphabet, x, y); + }, + R"pbdoc( +:sig=(x: str | list[int], y: str | list[int]) -> bool: +:only-document-once: +Compare two words using len-lex ordering. - The lexicographic ordering. Note that this is not a well-order, so there may - not be a lexicographically least word in a given congruence class of words. +Words are first ordered by length and then lexicographically. The +three-argument overload ``lenlex_cmp(alphabet, x, y)`` compares letters by +their positions in *alphabet*. It raises :any:`LibsemigroupsError` if either +word contains a letter that does not belong to *alphabet*. -.. py:attribute:: Order.recursive - :value: +:param x: the first word. +:type x: str | list[int] +:param y: the second word. +:type y: str | list[int] +:returns: Whether *x* is less than *y*. +:rtype: bool +)pbdoc"); - The recursive-path ordering, as described in :cite:`Jantzen2012aa` (Definition - 1.2.14, page 24). -)pbdoc") - .value("none", Order::none) - .value("shortlex", Order::shortlex) - .value("lex", Order::lex) - .value("recursive", Order::recursive); - - // No prefix because not in subpackage - m.def( - "lexicographical_compare", - [](std::string const& x, std::string const& y) { - return lexicographical_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( + bind_compare( + m, + "rpo_cmp", + [](Word const& x, Word const& y) { return rpo_cmp(x, y); }, + [](Alphabet const& alphabet, Word const& x, Word const& y) { + return rpo_cmp(alphabet, x, y); + }, + R"pbdoc( :sig=(x: str | list[int], y: str | list[int]) -> bool: :only-document-once: -Compare two values of type :any:`str` or ``list[int]`` using lexicographical ordering. +Compare two words using recursive-path ordering. -:param x: the first object for comparison. -:type x: str | list[int] +The three-argument overload ``rpo_cmp(alphabet, x, y)`` compares letters by +their positions in *alphabet*. It raises :any:`LibsemigroupsError` if either +word contains a letter that does not belong to *alphabet*. -:param y: the second object for comparison. +:param x: the first word. +:type x: str | list[int] +:param y: the second word. :type y: str | list[int] - -:returns: The boolean value ``True`` if *x* is lexicographically less than *y*, and ``False`` otherwise. +:returns: Whether *x* is less than *y*. :rtype: bool -:complexity: At most :math:`O(n)` where :math:`n` is the minimum of the length of *x* and the length of *y*. +.. warning:: + This function has significantly worse performance than :any:`lenlex_cmp` + and :any:`lex_cmp`. )pbdoc"); - // No prefix because not in subpackage - m.def( - "lexicographical_compare", - [](word_type const& x, word_type const& y) { - return lexicographical_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( + bind_compare( + m, + "rev_rpo_cmp", + [](Word const& x, Word const& y) { return rev_rpo_cmp(x, y); }, + [](Alphabet const& alphabet, Word const& x, Word const& y) { + return rev_rpo_cmp(alphabet, x, y); + }, + R"pbdoc( :sig=(x: str | list[int], y: str | list[int]) -> bool: :only-document-once: -)pbdoc"); +Compare two words using reversed recursive-path ordering. - // No prefix because not in subpackage - m.def( - "shortlex_compare", - [](std::string const& x, std::string const& y) { - return shortlex_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( -:sig=(x: str | list[int], y: str | list[int]) -> bool: -:only-document-once: -Compare two values of type :any:`str` or ``list[int]`` using shortlex ordering. +This is recursive-path ordering applied after reading both words from right to +left. The three-argument overload ``rev_rpo_cmp(alphabet, x, y)`` compares +letters by their positions in *alphabet*. It raises +:any:`LibsemigroupsError` if either word contains a letter that does not belong +to *alphabet*. -:param x: the first object for comparison. +:param x: the first word. :type x: str | list[int] - -:param y: the second object for comparison. +:param y: the second word. :type y: str | list[int] - -:returns: The boolean value ``True`` if *x* is short-lex less than *y*, and ``False`` otherwise. +:returns: Whether *x* is less than *y*. :rtype: bool -:complexity: At most :math:`O(n)` where :math:`n` is the minimum of the length of *x* and the length of *y*. +.. warning:: + This function has significantly worse performance than :any:`lenlex_cmp` + and :any:`lex_cmp`. )pbdoc"); - // No prefix because not in subpackage - m.def( - "shortlex_compare", - [](word_type const& x, word_type const& y) { - return shortlex_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( + bind_deprecated_compare( + m, + "lexicographical_compare", + "lex_cmp", + [](Word const& x, Word const& y) { return lex_cmp(x, y); }, + R"pbdoc( :sig=(x: str | list[int], y: str | list[int]) -> bool: :only-document-once: +Compare two words lexicographically. + +.. deprecated:: 1.5 + This will be removed from ``libsemigroups_pybind11`` in v2. Instead, use + :any:`lex_cmp`. )pbdoc"); - // No prefix because not in subpackage - m.def( - "recursive_path_compare", - [](std::string const& x, std::string const& y) { - return recursive_path_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( + bind_deprecated_compare( + m, + "shortlex_compare", + "lenlex_cmp", + [](Word const& x, Word const& y) { return lenlex_cmp(x, y); }, + R"pbdoc( :sig=(x: str | list[int], y: str | list[int]) -> bool: :only-document-once: -Compare two values of type :any:`str` or ``list[int]`` using recursive-path ordering. +Compare two words using len-lex ordering. -This function compares two values of type :any:`str` or ``list[int]`` using the -recursive-path ordering described in :cite:`Jantzen2012aa` (Definition 1.2.14, -page 24). - -If :math:`u, v\in X ^ {*}`, :math:`u \neq v`, and :math:`u = a'u`, -:math:`v = bv'` for some :math:`a,b \in X`, :math:`u',v'\in X ^ {*}`, then -:math:`u > v` if one of the following conditions holds: +.. deprecated:: 1.5 + This will be removed from ``libsemigroups_pybind11`` in v2. Instead, use + :any:`lenlex_cmp`. +)pbdoc"); -#. :math:`a = b` and :math:`u' \geq v'`; -#. :math:`a > b` and :math:`u > v'`; -#. :math:`b > a` and :math:`u' > v`. + bind_deprecated_compare( + m, + "recursive_path_compare", + "rev_rpo_cmp", + [](Word const& x, Word const& y) { return rev_rpo_cmp(x, y); }, + R"pbdoc( +:sig=(x: str | list[int], y: str | list[int]) -> bool: +:only-document-once: +Compare two words using reversed recursive-path ordering. -This documentation and the implementation of :any:`recursive_path_compare` -is based on the source code of :cite:`Holt2018aa`. +.. deprecated:: 1.5 + This will be removed from ``libsemigroups_pybind11`` in v2. Instead, use + :any:`rev_rpo_cmp`. +)pbdoc"); + } + } // namespace -:param x: the first object for comparison. -:type x: str | list[int] + void init_order(py::module& m) { + py::options options; + options.disable_enum_members_docstring(); -:param y: the second object for comparison. -:type y: str | list[int] + py::enum_(m, "Order", R"pbdoc( +An enum class for the possible orderings of words and strings. -:returns: The boolean value ``True`` if *x* is less than *y* with respect to the recursive path ordering, and ``False`` otherwise. -:rtype: bool +The values in this enum can be used as the arguments for functions such as +:any:`ToddCoxeter.standardize` or :any:`WordRange.order` to specify which +ordering should be used. -.. warning:: - This function has significantly worse performance than - :any:`shortlex_compare` and :any:`lexicographical_compare`. -)pbdoc"); +The values :any:`Order.shortlex` and :any:`Order.recursive` are retained for +backwards compatibility; use :any:`Order.lenlex` and :any:`Order.rev_rpo`, +respectively, in new code. +)pbdoc") + .value("none", Order::none) + .value("lenlex", Order::lenlex) + .value("shortlex", Order::lenlex) + .value("lex", Order::lex) + .value("rpo", Order::rpo) + .value("rev_rpo", Order::rev_rpo) + .value("recursive", Order::rev_rpo); - // No prefix because not in subpackage - m.def( - "recursive_path_compare", - [](word_type const& x, word_type const& y) { - return recursive_path_compare(x, y); - }, - py::arg("x"), - py::arg("y"), - R"pbdoc( -:sig=(x: str | list[int], y: str | list[int]) -> bool: -:only-document-once: -)pbdoc"); + bind_order_comparisons(m); + bind_order_comparisons(m); } } // namespace libsemigroups diff --git a/src/to-froidure-pin.cpp b/src/to-froidure-pin.cpp index 4c7f557f..fc5886fb 100644 --- a/src/to-froidure-pin.cpp +++ b/src/to-froidure-pin.cpp @@ -52,10 +52,10 @@ namespace libsemigroups { } // namespace void init_to_froidure_pin(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; // Congruence bind_to_froidure_pin>(m); @@ -72,10 +72,10 @@ namespace libsemigroups { bind_to_froidure_pin>(m); bind_to_froidure_pin>(m); - bind_to_froidure_pin>(m); - bind_to_froidure_pin>(m); - bind_to_froidure_pin>(m); - bind_to_froidure_pin>(m); + bind_to_froidure_pin>(m); + bind_to_froidure_pin>(m); + bind_to_froidure_pin>(m); + bind_to_froidure_pin>(m); // ToddCoxeter bind_to_froidure_pin>(m); diff --git a/src/to-knuth-bendix.cpp b/src/to-knuth-bendix.cpp index 8c420a94..c3ffa79d 100644 --- a/src/to-knuth-bendix.cpp +++ b/src/to-knuth-bendix.cpp @@ -65,10 +65,10 @@ namespace libsemigroups { } // namespace void init_to_knuth_bendix(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; // FroidurePin bind_froidure_pin_to_knuth_bendix( @@ -79,21 +79,24 @@ namespace libsemigroups { "word_LenLexSet"); bind_froidure_pin_to_knuth_bendix(m, "word_LenLexTrie"); - bind_froidure_pin_to_knuth_bendix(m, "string_RPOSet"); - bind_froidure_pin_to_knuth_bendix(m, - "string_RPOTrie"); - bind_froidure_pin_to_knuth_bendix(m, "word_RPOSet"); - bind_froidure_pin_to_knuth_bendix(m, "word_RPOTrie"); + bind_froidure_pin_to_knuth_bendix( + m, "string_RevRPOSet"); + bind_froidure_pin_to_knuth_bendix( + m, "string_RevRPOTrie"); + bind_froidure_pin_to_knuth_bendix(m, + "word_RevRPOSet"); + bind_froidure_pin_to_knuth_bendix(m, + "word_RevRPOTrie"); // ToddCoxeter + rewriter bind_todd_coxeter_to_knuth_bendix(m, "LenLexSet"); bind_todd_coxeter_to_knuth_bendix(m, "LenLexSet"); bind_todd_coxeter_to_knuth_bendix(m, "LenLexTrie"); bind_todd_coxeter_to_knuth_bendix(m, "LenLexTrie"); - bind_todd_coxeter_to_knuth_bendix(m, "RPOSet"); - bind_todd_coxeter_to_knuth_bendix(m, "RPOSet"); - bind_todd_coxeter_to_knuth_bendix(m, "RPOTrie"); - bind_todd_coxeter_to_knuth_bendix(m, "RPOTrie"); + bind_todd_coxeter_to_knuth_bendix(m, "RevRPOSet"); + bind_todd_coxeter_to_knuth_bendix(m, "RevRPOSet"); + bind_todd_coxeter_to_knuth_bendix(m, "RevRPOTrie"); + bind_todd_coxeter_to_knuth_bendix(m, "RevRPOTrie"); // ToddCoxeter bind_todd_coxeter_to_knuth_bendix_default(m); diff --git a/src/to-presentation.cpp b/src/to-presentation.cpp index 3103d439..f7e12189 100644 --- a/src/to-presentation.cpp +++ b/src/to-presentation.cpp @@ -190,10 +190,10 @@ namespace libsemigroups { } // namespace void init_to_present(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; //////////////////////////////////////////////////////////////////////////// // to @@ -227,19 +227,20 @@ namespace libsemigroups { bind_kb_to_pres_with_word(m, "word"); bind_kb_to_pres_with_word(m, "word"); - bind_kb_to_pres(m); - bind_kb_to_pres(m); - bind_kb_to_pres(m); - bind_kb_to_pres(m); - - bind_kb_to_pres_with_word(m, "string"); - bind_kb_to_pres_with_word(m, "string"); - bind_kb_to_pres_with_word(m, "string"); - bind_kb_to_pres_with_word(m, "string"); - bind_kb_to_pres_with_word(m, "word"); - bind_kb_to_pres_with_word(m, "word"); - bind_kb_to_pres_with_word(m, "word"); - bind_kb_to_pres_with_word(m, "word"); + bind_kb_to_pres(m); + bind_kb_to_pres(m); + bind_kb_to_pres(m); + bind_kb_to_pres(m); + + bind_kb_to_pres_with_word(m, "string"); + bind_kb_to_pres_with_word(m, + "string"); + bind_kb_to_pres_with_word(m, "string"); + bind_kb_to_pres_with_word(m, "string"); + bind_kb_to_pres_with_word(m, "word"); + bind_kb_to_pres_with_word(m, "word"); + bind_kb_to_pres_with_word(m, "word"); + bind_kb_to_pres_with_word(m, "word"); // From FroidurePin bind_fp_to_pres(m, "string"); diff --git a/src/to-todd-coxeter.cpp b/src/to-todd-coxeter.cpp index 9ee2a46e..450f3e1e 100644 --- a/src/to-todd-coxeter.cpp +++ b/src/to-todd-coxeter.cpp @@ -51,10 +51,10 @@ namespace libsemigroups { } // namespace void init_to_todd_coxeter(py::module& m) { - using LenLexTrie = detail::RewritingSystemTrie; - using LenLexSet = detail::RewritingSystemSet; - using RPOTrie = detail::RewritingSystemTrie; - using RPOSet = detail::RewritingSystemSet; + using LenLexTrie = detail::RewritingSystemTrie; + using LenLexSet = detail::RewritingSystemSet; + using RevRPOTrie = detail::RewritingSystemTrie; + using RevRPOSet = detail::RewritingSystemSet; // KnuthBendix bind_to_todd_coxeter_kb(m); @@ -62,10 +62,10 @@ namespace libsemigroups { bind_to_todd_coxeter_kb(m); bind_to_todd_coxeter_kb(m); - bind_to_todd_coxeter_kb(m); - bind_to_todd_coxeter_kb(m); - bind_to_todd_coxeter_kb(m); - bind_to_todd_coxeter_kb(m); + bind_to_todd_coxeter_kb(m); + bind_to_todd_coxeter_kb(m); + bind_to_todd_coxeter_kb(m); + bind_to_todd_coxeter_kb(m); // WordGraph m.def("to_todd_coxeter_word", diff --git a/tests/test_order.py b/tests/test_order.py new file mode 100644 index 00000000..5805036f --- /dev/null +++ b/tests/test_order.py @@ -0,0 +1,75 @@ +# Copyright (c) 2026 J. D. Mitchell +# +# Distributed under the terms of the GPL license version 3. +# +# The full license is in the file LICENSE, distributed with this software. + +"""Tests for order.cpp.""" + +import pytest + +from libsemigroups_pybind11 import ( + Alphabet, + LibsemigroupsError, + Order, + lenlex_cmp, + lex_cmp, + lexicographical_compare, + recursive_path_compare, + rev_rpo_cmp, + rpo_cmp, + shortlex_compare, +) + + +@pytest.mark.parametrize( + ("compare", "x", "y"), + [ + (lex_cmp, "ab", "ba"), + (lex_cmp, [0, 1], [1, 0]), + (lenlex_cmp, "ba", "aaa"), + (lenlex_cmp, [1, 0], [0, 0, 0]), + (rpo_cmp, "ab", "ba"), + (rpo_cmp, [0, 1], [1, 0]), + (rev_rpo_cmp, "ab", "ba"), + (rev_rpo_cmp, [0, 1], [1, 0]), + ], +) +def test_compare_without_alphabet(compare, x, y): + """Check that each comparison function works without an alphabet.""" + assert isinstance(compare(x, y), bool) + + +@pytest.mark.parametrize("compare", [lex_cmp, lenlex_cmp, rpo_cmp, rev_rpo_cmp]) +@pytest.mark.parametrize( + ("alphabet", "x", "y", "missing"), + [(Alphabet("ba"), "ba", "ab", "c"), (Alphabet([1, 0]), [1, 0], [0, 1], [2])], +) +def test_compare_with_alphabet(compare, alphabet, x, y, missing): + """Check alphabet-aware comparisons and reject unknown letters.""" + assert isinstance(compare(alphabet, x, y), bool) + + with pytest.raises(LibsemigroupsError): + compare(alphabet, x, x + missing) + + +def test_order_values_and_backwards_compatible_aliases(): + """Check the new order values and their backwards-compatible aliases.""" + assert Order.shortlex == Order.lenlex + assert Order.recursive == Order.rev_rpo + assert Order.rpo != Order.rev_rpo + + +@pytest.mark.parametrize( + ("old_compare", "new_compare"), + [ + (lexicographical_compare, lex_cmp), + (shortlex_compare, lenlex_cmp), + (recursive_path_compare, rev_rpo_cmp), + ], +) +def test_deprecated_comparisons(old_compare, new_compare): + """Check that legacy comparisons warn and delegate to their replacements.""" + with pytest.deprecated_call(): + result = old_compare("ab", "ba") + assert result == new_compare("ab", "ba") diff --git a/tests/test_stephen.py b/tests/test_stephen.py index ae6d4cba..01f6b0f2 100644 --- a/tests/test_stephen.py +++ b/tests/test_stephen.py @@ -26,7 +26,7 @@ ToWord, WordGraph, congruence_kind, - lexicographical_compare, + lex_cmp, presentation, stephen, todd_coxeter, @@ -69,22 +69,22 @@ def check_000(s): # The following is needed so that we can sort lists with a custom order. # Why does Python not support a comparator directly? Who knows. # Why does it not automatically convert a boolean comparator to a key function? WHO KNOWS! -def lexicographic_compare_comparator(x, y) -> int: +def lex_cmp_comparator(x, y) -> int: if x == y: return 0 - if lexicographical_compare(x, y): + if lex_cmp(x, y): return -1 return 1 -lexicographic_compare_key_func = cmp_to_key(lexicographic_compare_comparator) +lex_cmp_key_func = cmp_to_key(lex_cmp_comparator) def verify_c4_normal_form(p, word, nf): S = Stephen(p) S.set_word(word).run() - assert sorted(list(stephen.words_accepted(S)), key=lexicographic_compare_key_func)[0] == nf + assert sorted(list(stephen.words_accepted(S)), key=lex_cmp_key_func)[0] == nf assert all(stephen.accepts(S, w) for w in stephen.words_accepted(S)) assert stephen.number_of_words_accepted(S) == sum(1 for _ in stephen.words_accepted(S)) @@ -574,9 +574,7 @@ def test_stephen_008(): to_word("dgabcdg"), ] - assert sorted(list(stephen.words_accepted(S)), key=lexicographic_compare_key_func)[ - 0 - ] == to_word("dfabcdf") + assert sorted(list(stephen.words_accepted(S)), key=lex_cmp_key_func)[0] == to_word("dfabcdf") assert all(stephen.accepts(S, w) for w in stephen.words_accepted(S)) assert stephen.number_of_words_accepted(S) == sum(1 for _ in stephen.words_accepted(S)) @@ -584,7 +582,7 @@ def test_stephen_008(): S.set_word(to_word("abcdfceg")).run() assert stephen.number_of_words_accepted(S) == 16 - assert sorted(list(stephen.words_accepted(S)), key=lexicographic_compare_key_func) == [ + assert sorted(list(stephen.words_accepted(S)), key=lex_cmp_key_func) == [ to_word("abcdfabcdf"), to_word("abcdfabcdg"), to_word("abcdfcef"), @@ -603,9 +601,7 @@ def test_stephen_008(): to_word("cegceg"), ] - assert sorted(list(stephen.words_accepted(S)), key=lexicographic_compare_key_func)[ - 0 - ] == to_word("abcdfabcdf") + assert sorted(list(stephen.words_accepted(S)), key=lex_cmp_key_func)[0] == to_word("abcdfabcdf") assert stephen.accepts(S, to_word("abcdfabcdf")) diff --git a/tests/test_to.py b/tests/test_to.py index ba9f1ad1..682020c1 100644 --- a/tests/test_to.py +++ b/tests/test_to.py @@ -15,12 +15,12 @@ from _libsemigroups_pybind11 import ( FroidurePinKBEStringLenLexSet, FroidurePinKBEStringLenLexTrie, - FroidurePinKBEStringRPOSet, - FroidurePinKBEStringRPOTrie, + FroidurePinKBEStringRevRPOSet, + FroidurePinKBEStringRevRPOTrie, FroidurePinKBEWordLenLexSet, FroidurePinKBEWordLenLexTrie, - FroidurePinKBEWordRPOSet, - FroidurePinKBEWordRPOTrie, + FroidurePinKBEWordRevRPOSet, + FroidurePinKBEWordRevRPOTrie, FroidurePinKEMultiViewString, FroidurePinKEString, FroidurePinKEWord, @@ -236,7 +236,7 @@ def test_to_FroidurePin_000(): assert isinstance(to_cxx(fp), FroidurePinKBEStringLenLexSet) fp = check_cong_to_froidure_pin(KnuthBendix, str, rewriting_system="Set", order=Order.recursive) - assert isinstance(to_cxx(fp), FroidurePinKBEStringRPOSet) + assert isinstance(to_cxx(fp), FroidurePinKBEStringRevRPOSet) def test_to_FroidurePin_001(): @@ -246,7 +246,7 @@ def test_to_FroidurePin_001(): fp = check_cong_to_froidure_pin( KnuthBendix, str, rewriting_system="Trie", order=Order.recursive ) - assert isinstance(to_cxx(fp), FroidurePinKBEStringRPOTrie) + assert isinstance(to_cxx(fp), FroidurePinKBEStringRevRPOTrie) def test_to_FroidurePin_002(): @@ -254,7 +254,7 @@ def test_to_FroidurePin_002(): assert isinstance(to_cxx(fp), FroidurePinKBEWordLenLexSet) fp = check_cong_to_froidure_pin(KnuthBendix, int, rewriting_system="Set", order=Order.recursive) - assert isinstance(to_cxx(fp), FroidurePinKBEWordRPOSet) + assert isinstance(to_cxx(fp), FroidurePinKBEWordRevRPOSet) def test_to_FroidurePin_003(): @@ -264,7 +264,7 @@ def test_to_FroidurePin_003(): fp = check_cong_to_froidure_pin( KnuthBendix, int, rewriting_system="Trie", order=Order.recursive ) - assert isinstance(to_cxx(fp), FroidurePinKBEWordRPOTrie) + assert isinstance(to_cxx(fp), FroidurePinKBEWordRevRPOTrie) # From ToddCoxeter