Primitive-recursive list operations #
Rotation and cyclic-permutation testing are primitive recursive on the standard list encoding. The bounded rotation criterion includes the empty list, so it also applies to cyclic reductions of trivial free-group words.
Searching a list for its first element passing a test, List.find?, is primitive recursive.
Over List.range n this is the bounded least-witness search of finite-stage constructions,
returning none when no number below n passes the test. A relation searched over all numbers
up to the length of a primitive-recursively computed list stays primitive recursive
(PrimrecRel.exists_le_length).
Rotating a list by a natural number is primitive recursive.
The first element of a list passing a test, if any, is primitive recursive, uniformly in a parameter on which the list and the test depend primitive recursively.
A relation searched over all n ≤ (f b).length, for f primitive recursive, stays
primitive recursive.
Cyclic permutation is a primitive-recursive relation, including for empty lists.