examples of primitive recursive predicates

In the examples, we use Φ⁢(𝒙) to indicate a predicate (over the natural numbersℕ). First, two very simple examples:

1.

Φ⁢(x) given by “x=n” for a fixed n∈ℕ is primitive recursive. To see this, note that the set associated with Φ is {n}, and its associated characteristic function is primitive recursive by example 3(l) in this entry (http://planetmath.org/ExamplesOfPrimitiveRecursiveFunctions). As a result, Φ is primitive recursive.

2.

Φ⁢(x,y) given by “x≤y” is primitive recursive. The associated set is {(x,y)∣x≤y} whose characteristic function is sgn⁡(s⁢(y)⁢-˙⁢x), which is primitive recursive.

Before exhibiting more examples, we prove some basic facts about primitive recursive predicates:

Proposition 1.

Proof.

Let S,T be the sets associated with the predicates Φ and Θ. We may assume that S,T⊆ℕk for some positive integerk. Let cS and cT be the associated characteristic functions.

First, 1⁢-˙⁢cS is the characteristic function of ℕk-S, which is the associated set of the predicate ¬⁢Φ. Since 1⁢-˙⁢cS is primitive recursive, so is ¬⁢Φ.

Next, mult⁡(CS,CT) is the characteristic function of S∩T, which is the associated set of the predicate Φ∧Θ. Since mult⁡(CS,CT) is primitive recursive, so is Φ∧Θ.

Finally, the set associated with Φ∨Θ is S∪T, which is ℕk-((ℕk-S)∩(ℕk-T)), which is primitive recursive. Hence Φ∨Θ is primitive recursive as well.
∎

In short, primitive recursiveness is preserved under Boolean operations on predicates. By induction, we also see primitive recursiveness is preserved under finite disjunction and finite conjunction.

Using this fact, we list three more examples:

3.

the predicate “x=y” is primitive recursive, since it is the conjunction of primitive recursive predicates “x≤y” and “y≤x”.

4.

the predicate “y<x” is primitive recursive, since it is the conjunction “y≤x” and “¬⁡(x=y)”, both of which are primitive recursive.

5.

the predicate “x∈S”, where S is a fixed finite set, is primitive recursive, as it is the disjunction of primitive predicates of the form “x=n”, where n ranges over S. Since the disjunction operation is finitary, “x∈S” is primitive recursive also.

Proof.

Let cΦ be the characteristic function of (the set associated with) Φ, then

cΦ⁢(f1⁢(x1,…,xn),…,fm⁢(x1,…,xn))

is cΘ, the characteristic function of Θ. Since cΦ, fi are primitive recursive, cΘ, obtained by functionalcomposition, and hence Θ, are primitive recursive too.
∎

Let us list two more examples:

6.

the predicate “x⁢y≠z” is primitive recursive.

7.

the predicate “y<x!” is primitive recursive.

Finite disjunctions and finite conjunctions of predicates can be thought of as special cases of bounded quantification (http://planetmath.org/BoundedQuantifier) on predicates. In view of this, we have the following facts:

Proposition 3.

If Φ⁢(𝐱,y) is primitive recursive, so are

Θ⁢(𝒙,y):=∀z≤y⁢Φ⁢(𝒙,z)𝑎𝑛𝑑Ψ⁢(𝒙,y):=∃z≤y⁢Φ⁢(𝒙,z).

Proof.

The set associated with Θ⁢(𝒙,y) is {(𝒙,y)∣ for all ⁢z≤y,Φ⁢(𝒙,z)}, which is just

S:={(𝒙,y)∣Φ⁢(𝒙,0)}∩{(𝒙,y)∣Φ⁢(𝒙,1)}∩⋯∩{(𝒙,y)∣Φ⁢(𝒙,y)}

For each fixed i, let Φi⁢(𝒙):=Φ⁢(𝒙,i). Then by proposition 2, Φi is primitive recursive. Let ci be the characteristic function of Φi, and d the function such that d⁢(𝒙,i) is ci⁢(𝒙) if i∈{0,…,n}, and 0 otherwise. So d is primitive recursive (see this entry (http://planetmath.org/ExamplesOfPrimitiveRecursiveFunctions)). Now, define function c by

As a result, 1=c⁢(𝒙,y) iff (𝒙,y)∈{(𝒙,y)∣Φ⁢(𝒙,i)} for all i∈{0,…,y} iff (𝒙,y)∈S. In other words, c is the characteristic function of S. Since c is obtained from d by bounded product, c is primitive recursive. This shows that Θ is primitive recursive as well.

Next, since the characteristic function of Ψ⁢(𝒙,y) is the same as the characteristic function of ¬⁢∀z≤y⁢(¬⁢Φ⁢(𝒙,z)), we conclude that Ψ is primitive recursive by proposition 1 and what we have just proved.
∎

Our final example is the following:

8.

Φ⁢(x) given by “x is prime” is primitive recursive. One way to characterize Φ is the following: 1<x, and x can not be written as a product of two natural numbers, both greater than 1. In other words,

Φ(x)≡(1<x)∧∀y(∀z¬(x=yz∧1<y∧1<z)),

where ≡ means “can be characterized by” (they share the same characteristic function). Observe that since x=y⁢z, both y and z are in fact bounded by x. Therefore,

Φ(x)≡(1<x)∧∀y≤x(∀z≤x¬(x=yz∧1<y∧1<z)).

As each of x=y⁢z,1<y, and 1<z is primitive recursive, so are their conjunction: