primitive recursive encoding
Recall that an encoding of a set of words over some alphabet is defined as an injective function , the set of natural numbers (including here).
Finite sequences over can be thought of as words over the “infinite
” alphabet . So the notion of word encoding directly carries over to encoding of finite sequences of natural numbers
. Let be the set of all finite sequences over .
Definition. Let be an encoding for . A number is called a sequence number if it is in the range of . Since is injective, we say that is the sequence number of the sequence .
Once is fixed, we also use the notation to mean the sequence number of the sequence .
Define the following operations on associated with a given :
- 1.
, the restriction
of to the set of all sequences of length , and is defined as the number .
- 2.
the length function: :
- 3.
, such that
- 4.
, such that
The notation stands for the concatenation
of the sequences and .
- 5.
, such that
The notation stands for the sequence , extended by appending to the right of .
- 6.
, such that
In other words, is the sequence number of the sequence obtained by removing the last (rightmost) number (if any) in the sequence whose sequence number is , provided that is a sequence number.
Definition. An encoding for is said to be primitive recursive if
- •
is a primitive recursive set, and
- •
the first three types of functions defined above are primitive recursive.
Proposition 1.
If is primitive recursive, so are the functions , and .
Proof.
Let be the characteristic function of the predicate “ is a sequence number” (via ). It is primitive recursive by assumption
.
- 1.
Let . Then , which is primitive recursive.
- 2.
Let . Then , which is primitive recursive.
- 3.
Let . Then
which is primitive recursive.
∎
Examples of primitive recursive encoding can be found in the parent entry (methods 2, 3, and 7).