Orders
This page contains the documentation for several functions for comparing words or strings with respect to certain reduction orderings.
See also
Contents
Compare two values of type |
|
Compare two values of type |
|
Compare two values of type |
Full API
- lexicographical_compare(x: str | list[int], y: str | list[int]) bool
Compare two values of type
str
orlist[int]
using using lexicographical ordering.- Parameters:
- Returns:
The boolean value
True
if x is lexicographically less than y, andFalse
otherwise.- Return type:
- Complexity:
At most \(O(n)\) where \(n\) is the minimum of the length of x and the length of y.
- recursive_path_compare(x: str | list[int], y: str | list[int]) bool
Compare two values of type
str
orlist[int]
using recursive-path ordering.Compare two values of type
str
orlist[int]
using the recursive path comparison described in [Jan12] (Definition 1.2.14, page 24).If \(u, v\in X ^ {*}\), \(u \neq v\), and \(u = a'u\), \(v = bv'\) for some \(a,b \in X\), \(u',v'\in X ^ {*}\), then \(u > v\) if one of the following conditions holds:
\(a = b\) and \(u' \geq v'\);
\(a > b\) and \(u > v'\);
\(b > a\) and \(u' > v\).
This documentation and the implementation of
recursive_path_compare
is based on the source code of [Hol19].- Parameters:
- Returns:
The boolean value
True
if x is less than y with respect to the recursive path ordering, andFalse
otherwise.- Return type:
- Warning:
This function has significantly worse performance than
shortlex_compare
andlexicographical_compare
.
- shortlex_compare(x: str | list[int], y: str | list[int]) bool
Compare two values of type
str
orlist[int]
using shortlex ordering.- Parameters:
- Returns:
The boolean value
True
if x` is short-lex less than y, andFalse
otherwise.- Return type:
- Complexity:
At most \(O(n)\) where \(n\) is the minimum of the length of x and the length of y.