← 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 FF− recursive set is the smallest FF− 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 FF− 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:nn+2fn:n→n+2.

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

Along with the closure property (that EE is FF− 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 FF− closed, then EXE⊆X. Note how XX can represent any property (e.g. "nice") and since we know that XX is FF− closed, we can prove by induction that every even number is "nice".

Now see that EE is the smallest FF− closed set -- which we define as being FF− recursive. Intuitively, f0f0 tells us that 00 is necessarily in an FF− 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 FF− recursive set.

Proof:

Let X,YAX,Y⊆A be arbitrary FF− recursive sets.

Both XX and YY are FF− closed. But then, by definition, XX is FF− inductive which means that XYX⊆Y. Similarly, we have that YXY⊆X. Therefore, X=YX=Y i.e. there is exactly one FF− 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:NN×Nf1:ℕ→ℕ×ℕ that takes n(n,n)n→(n,n), and a two place function f2:N×NN×Nf2:ℕ×ℕ→ℕ×ℕ that takes (m,n)(m,suc(n))(m,n)→(m,suc(n)). Therefore, the relation is the FF− recursive set on these operations.


Example 2.2.6

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

Proof:

Call (m,n)(m,n) nice iff either m=nm=n or msuc(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 nnn≤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 mnmsuc(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=nsuc(m)nm=n∨suc(m)≤n.

Case m=nm=n:

m=nsuc(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)nsuc(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 mnm≤n, either m=nm=n or msuc(n)m≤suc(n).

Exercise 2.2.7

Prove by induction that for all numbers m,n,km,n,k if mnm≤n and nkn≤k then mkm≤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 mnmkm≤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, mnmnm≤n⟹m≤n. The base case is satisfied.

Inductive case nknsuc(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 mnmkm≤n⟹m≤k holds, and show that it follows that mnmsuc(k)m≤n⟹m≤suc(k).

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

Therefore, mnmsuc(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:AAs:A→A be a function. Then there is a unique function f:NAf:ℕ→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 aAa∈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 bAb∈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=0a=zn=0⟹a=z.

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

Here, (n,a)=(0,z)n=0a=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 asuc(n)a⟹suc(n) selects s(a)s(a).

Here, we assume that for (n,a)(n,a) it holds that n=0a=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)=0s(a)=zsuc(n)=0⟹s(a)=z.

Note how suc(n)=0suc(n)=0 is always false. Therefore, suc(n)=0s(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 (pN,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, (pN,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 asuc(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 nNn∈ℕ, particularly it is the successor of pp, and aNa∈ℕ 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 bAb∈A such that nn selects bb and s(b)=as(b)=a.

2.3.6 Exercise

Prove the following:

  1. For each number nNn∈ℕ there is at least one aAa∈A such that nn selects aa.
  2. For each number nNn∈ℕ there is at most one aAa∈A such that nn selects aa.

Proof for 1:

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

Base case: n=0n=0

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

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

We show that there is some bAb∈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 nNn∈ℕ there is at least one aAa∈A such that nn selects aa.

Proof for 2:

We prove by induction on the natural numbers that For each number nNn∈ℕ there is at most one aAa∈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 aAa∈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 aAa∈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 bAb∈A. Then by the result in 2.3.5-2, there is some xAx∈A such that nn selects xx and b=s(x)b=s(x).

But by our assumption, nn selects at most one aAa∈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 nNn∈ℕ there is at most one aAa∈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:NAf:ℕ→A such that:

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

We now prove that:

  1. For each aAa∈A, f(0)=af(0)=a iff a=za=z.
  2. For each aAa∈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 aAa∈A. Then, by the definition of ff, we have that 00 selects aa. But 00 exclusively selects zAz∈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 aAa∈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 bAb∈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 aAa∈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.