← Index

Limits of Logic #4: Recursion Theorem

From: Limits of Logic (Jeffrey Sanford Russell)

Definition

Let FF be a set of operations on a set AA.

That is to say, the F−F− recursive set is the smallest F−F− closed set.


This definition formalizes recursive definitions which are "a way of defining an infinite set or relation, or a function with an infinite domain."

An example of a recursive definition of a set is the set of even numbers:

Here, we have recursively defined the property of "evenness" EE. Ultimately, a property really just is a set of all and only those elements which have that property. So the property EE really is the set of all even numbers.

In putting our recurvise definition of EE in context with the formal definition of F−F− recursiveness, we see that FF here contains two functions f0f0 and fnfn:

  1. A zero place function that outputs f0=0f0=0.
  2. A one place function fn:n→n+2fn:n→n+2.

What does an F−F− closed set look like? The even numbers EE are not the only F−F− closed set. Note how the set of all natural numbers Nℕ is also F−F− closed; 0∈N0∈ℕ and n∈N⟹n+2∈Nn∈ℕ⟹n+2∈ℕ.

Along with the closure property (that EE is F−F− closed), EE also has the inductive property. Intuitively, the inductive proeprty tells us that if for any XX:

Then really, alll even numbers are in XX.

In other words, if any XX is F−F− closed, then E⊆XE⊆X. Note how XX can represent any property (e.g. "nice") and since we know that XX is F−F− closed, we can prove by induction that every even number is "nice".

Now see that EE is the smallest F−F− closed set -- which we define as being F−F− recursive. Intuitively, f0f0 tells us that 00 is necessarily in an F−F− closed set, and fnfn takes 00 to 22,whichtakesusto$ 4$,... and eventually all and only even numbers.


Exercise 2.3.2

For any set of operations FF on a set AA, there is exactly one F−F− recursive set.

Proof:

Let X,Y⊆AX,Y⊆A be arbitrary F−F− recursive sets.

Both XX and YY are F−F− closed. But then, by definition, XX is F−F− inductive which means that X⊆YX⊆Y. Similarly, we have that Y⊆XY⊆X. Therefore, X=YX=Y i.e. there is exactly one F−F− recursive set. ∎∎


Definition

The relation mm is less than or equal to nn is recursively defined as follows:

Note that this definition of a relation defines a set of ordered pairs (m,n)(m,n).

In the context of the formal definition recursive definitions, here FF contains a one place function f1:N→N×Nf1:ℕ→ℕ×ℕ that takes n→(n,n)n→(n,n), and a two place function f2:N×N→N×Nf2:ℕ×ℕ→ℕ×ℕ that takes (m,n)→(m,suc(n))(m,n)→(m,suc(n)). Therefore, the ≤≤ relation is the F−F− recursive set on these operations.


Example 2.2.6

Prove that for any numbers mm and nn such that m≤nm≤n, either m=nm=n or m≤suc(n)m≤suc(n).

Proof:

Call (m,n)(m,n) nice iff either m=nm=n or m≤suc(n)m≤suc(n).

We are trying to prove that for every (m,n)(m,n) such that ≤≤ holds, (m,n)(m,n) is nice.

We shall prove this by induction on the ≤≤ relation.

Base Case n≤nn≤n.

By the first rule of the ≤≤ recursive definition, (n,n)(n,n) is a ≤≤ -pair. Clearly, (n,n)(n,n) is nice since n=nn=n.

Inductive Case m≤n⟹m≤suc(n)m≤n⟹m≤suc(n).

By the second rule of our recursive definition of ≤≤, we have that if (m,n)(m,n) is a ≤≤ -pair, then so is (m,suc(n))(m,suc(n)).

So, we'll assume that (m,n)(m,n) is nice and show that it follows that (m,suc(n))(m,suc(n)) is also nice.

So, assume that (m,n)(m,n) is nice, that is, m=n∨suc(m)≤nm=n∨suc(m)≤n.

Case m=nm=n:

m=n⟹suc(m)=suc(n)m=n⟹suc(m)=suc(n). Therefore, suc(m)≤suc(n)suc(m)≤suc(n) based on the first rule of the ≤≤ definition, and so, (m,suc(n))(m,suc(n)) is nice.

Case suc(m)≤nsuc(m)≤n:

suc(m)≤n⟹suc(m)≤suc(n)suc(m)≤n⟹suc(m)≤suc(n) based on the second rule of the ≤≤ definition, and so, (m,suc(n))(m,suc(n)) is nice.

In either case, (m,suc(n))(m,suc(n)) is nice.

Hence, we have proved that for any numbers mm and nn such that m≤nm≤n, either m=nm=n or m≤suc(n)m≤suc(n). ∎∎

Exercise 2.2.7

Prove by induction that for all numbers m,n,km,n,k if m≤nm≤n and n≤kn≤k then m≤km≤k.

Proof:

Let mm be any number and (n,k)(n,k) be a ≤≤ -pair.

We want to show by induction on the ≤≤ relation that for any ≤≤ -pair (n,k)(n,k), we have m≤n⟹m≤km≤n⟹m≤k.

Base Case ≤≤ -pair (n,n)(n,n)

By the first rule of the ≤≤ recursive definition, (n,n)(n,n) is a ≤≤ -pair. Clearly, m≤n⟹m≤nm≤n⟹m≤n. The base case is satisfied.

Inductive case n≤k⟹n≤suc(k)n≤k⟹n≤suc(k)

By the second rule of our recursive definition of ≤≤, we have that if (n,k)(n,k) is a ≤≤ -pair, then so is (n,suc(k))(n,suc(k)).

So, we'll assume that m≤n⟹m≤km≤n⟹m≤k holds, and show that it follows that m≤n⟹m≤suc(k)m≤n⟹m≤suc(k).

So, let m≤nm≤n. But then it follows from our assumption that m≤km≤k and by the the second rule of the recursive definition of ≤≤, we have that m≤suc(k)m≤suc(k).

Therefore, m≤n⟹m≤suc(k)m≤n⟹m≤suc(k).

2.3.4 The Recursion Theorem

Let AA be a set. Let zz be an element of AA, and let s:A→As:A→A be a function. Then there is a unique function f:N→Af:ℕ→A with these two properties:

Call these Recursive Properties.

We prove this theorem in parts. Particularly we prove that following relation " selects " is functional:

For a number nn and an element a∈Aa∈A we define the relation nn selects aa recusrively as follows:

We want to show that each number selects exactly value. Once we have done this, we will check the function for Recursive properties.

2.3.5 Exercise

Prove each of the following by induction on the definition of selects:

  1. If 00 selects aa then a=za=z.
  2. If suc(n)suc(n) selects aa then there is some b∈Ab∈A such that nn selects bb and s(b)=as(b)=a.

Proof of 1:

By induction on the selects relation, we want to show that for every selects-pair (n,a)(n,a), it holds that n=0⟹a=zn=0⟹a=z.

Base case: (0,z)(0,z) is a selects-pair

Here, (n,a)=(0,z)⟹n=0∧a=z(n,a)=(0,z)⟹n=0∧a=z. Therefore, it holds that If 00 selects aa then a=za=z.

Inductive case: nn selects a⟹suc(n)a⟹suc(n) selects s(a)s(a).

Here, we assume that for (n,a)(n,a) it holds that n=0⟹a=zn=0⟹a=z.

We now show that it follows that for (suc(n),s(a))(suc(n),s(a)), it holds that suc(n)=0⟹s(a)=zsuc(n)=0⟹s(a)=z.

Note how suc(n)=0suc(n)=0 is always false. Therefore, suc(n)=0⟹s(a)=zsuc(n)=0⟹s(a)=z trivially holds.

Therefore, we have shown by induction on the selects relation that if 00 selects aa, then a=za=z. ∎∎

Proof of 2:

We want to show that for every selects pair (p∈N,a)(p∈ℕ,a), it holds that p=suc(n)⟹s(b)=a∧(n,b)∈selectsp=suc(n)⟹s(b)=a∧(n,b)∈selects.

Base case: (0,z)(0,z) is a selects-pair

Here, (p∈N,a)=(0,z)⟹p=0(p∈ℕ,a)=(0,z)⟹p=0. Note how suc(n)=0suc(n)=0 is always false.

Therefore, p=suc(n)⟹s(b)=a∧(n,b)∈selectsp=suc(n)⟹s(b)=a∧(n,b)∈selects holds trivially.

Inductive case: pp selects a⟹suc(p)a⟹suc(p) selects s(a)s(a).

We assume that for (p,a)(p,a), it holds that p=suc(n)⟹s(b)=a∧(n,b)∈selectsp=suc(n)⟹s(b)=a∧(n,b)∈selects.

We show that it follows for (suc(p),s(a))(suc(p),s(a)) that p=suc(n)⟹s(b)=a∧(n,b)∈selectsp=suc(n)⟹s(b)=a∧(n,b)∈selects.

Note that clearly suc(p)suc(p) is a successor of some n∈Nn∈ℕ, particularly it is the successor of pp, and a∈Na∈ℕ is such that s(a)=s(a)∧(p,a)∈selectss(a)=s(a)∧(p,a)∈selects.

Therefore, (suc(p),s(a))(suc(p),s(a)) that p=suc(n)⟹s(b)=a∧(n,b)∈selectsp=suc(n)⟹s(b)=a∧(n,b)∈selects holds trivially.

We have shown by induction on the selects relation that If suc(n)suc(n) selects aa then there is some b∈Ab∈A such that nn selects bb and s(b)=as(b)=a. ∎∎

2.3.6 Exercise

Prove the following:

  1. For each number n∈Nn∈ℕ there is at least one a∈Aa∈A such that nn selects aa.
  2. For each number n∈Nn∈ℕ there is at most one a∈Aa∈A such that nn selects aa.

Proof for 1:

We prove by induction on the natural numbers that For each number n∈Nn∈ℕ there is at least one a∈Aa∈A such that nn selects aa.

Base case: n=0n=0

By definition of the selects relation, we have that n=0n=0 selects z∈Az∈A. Therefore, the base case is satisfied.

Inductive case: Assume there is some a∈Aa∈A such that nn selects aa.

We show that there is some b∈Ab∈A such that suc(n)suc(n) selects bb. Note by definition of the selects relation, suc(n)suc(n) selects b=s(a)∈Ab=s(a)∈A. Therefore the inductive case is satisfied.

We have shown by induction that for each number n∈Nn∈ℕ there is at least one a∈Aa∈A such that nn selects aa. ∎∎

Proof for 2:

We prove by induction on the natural numbers that For each number n∈Nn∈ℕ there is at most one a∈Aa∈A such that nn selects aa.

Base case: n=0n=0

By the result of 2.3.5 - 1, we have shown that if 00 selects some a∈Aa∈A, then a=za=z. Therefore, 00 selects at most one value. The base case is satisfied.

Inductive case: Assume there is at most one a∈Aa∈A such that nn selects aa.

We show that there is at most one b \in Asuchthatsuch thatsuc(n)selectsselectsb$.

Note by definition of the selects relation, suc(n)suc(n) selects s(a)∈As(a)∈A.

Now let's say that suc(n)suc(n) selects some b∈Ab∈A. Then by the result in 2.3.5-2, there is some x∈Ax∈A such that nn selects xx and b=s(x)b=s(x).

But by our assumption, nn selects at most one a∈Aa∈A. Therefore, x=ax=a and s(x)=s(a)=bs(x)=s(a)=b where suc(n)suc(n) selects b=s(a)b=s(a).

Therefore, suc(n)suc(n) selects at most one value, that is, s(a)s(a).

We have proved by induction that for each number n∈Nn∈ℕ there is at most one a∈Aa∈A such that nn selects aa. ∎∎

Completing the proof of Recursion theorem

Based on our results in 2.3.5 and 2.3.6 we can pick out a unique function f:N→Af:ℕ→A such that:

f(n)=af(n)=a iff nn selects aa for every n∈Nn∈ℕ and a∈Aa∈A.

We now prove that:

  1. For each a∈Aa∈A, f(0)=af(0)=a iff a=za=z.
  2. For each a∈Aa∈A, f(suc(n))=af(suc(n))=a iff a=s(f(n))a=s(f(n)).

Proof for 1:

Let f(0)=af(0)=a for some a∈Aa∈A. Then, by the definition of ff, we have that 00 selects aa. But 00 exclusively selects z∈Az∈A. This implies that a=za=z.

For the other direction, let a=za=z. We know 00 selects zz. Therefore, by definition of ff, we have that f(0)=z=af(0)=z=a.

Therefore, we have proved that for each a∈Aa∈A, f(0)=af(0)=a iff a=za=z. ∎∎

Proof for 2:

Let f(suc(n))=af(suc(n))=a. But then, we know that there is some b∈Ab∈A such that nn selects bb and a=s(b)a=s(b). By the definition of ff, f(n)=bf(n)=b.

Therefore, f(suc(n))=a=s(f(n))f(suc(n))=a=s(f(n)).

For the other direction, assume a=s(f(n))a=s(f(n)). By definition of ff, we have that nn selects f(n)f(n). By the definition of the selects relation, we have that suc(n)suc(n) selects s(f(n))s(f(n)). But again by definition of ff, we have that f(suc(n))=s(f(n))f(suc(n))=s(f(n)).

Therefore, f(suc(n))=a=s(f(n))f(suc(n))=a=s(f(n)).

We have proved that for each a∈Aa∈A, f(suc(n))=af(suc(n))=a iff a=s(f(n))a=s(f(n)).

This completes the proof of the recursion theorem. ∎∎