TheoremComplete

The Recursion Theorem

The recursion theorem is the fundamental result enabling recursive definitions on natural numbers. It formalizes the intuitive idea that we can define a sequence by specifying its first term and a rule for computing subsequent terms from previous ones.

TheoremRecursion Theorem for omega

Let AA be any set, a∈Aa \in A a fixed element, and h:Aβ†’Ah: A \to A a function. Then there exists a unique function f:Ο‰β†’Af: \omega \to A such that:

f(0)=af(n+1)=h(f(n))forΒ allΒ nβˆˆΟ‰\begin{align*} f(0) &= a \\ f(n+1) &= h(f(n)) \quad \text{for all } n \in \omega \end{align*}

This theorem guarantees that recursive definitions are legitimate: they define actual functions rather than circular pseudo-definitions. The proof requires showing both existence and uniqueness.

Proof

Existence: We construct ff as a union of approximations. Define a partial recursive function to be a function g:nβ†’Ag: n \to A for some nβˆˆΟ‰n \in \omega such that:

g(0)=ag(k+1)=h(g(k))forΒ allΒ k+1<n\begin{align*} g(0) &= a \\ g(k+1) &= h(g(k)) \quad \text{for all } k+1 < n \end{align*}

Let F\mathcal{F} be the set of all partial recursive functions. We claim:

  1. For each nβˆˆΟ‰n \in \omega, there is at most one partial recursive function with domain nn
  2. If g1:n1β†’Ag_1: n_1 \to A and g2:n2β†’Ag_2: n_2 \to A are both partial recursive, then g1g_1 and g2g_2 agree on n1∩n2n_1 \cap n_2

Proof of (1): By induction on nn. For n=0n = 0, the empty function is unique. If g,gβ€²:n+1β†’Ag, g': n+1 \to A are partial recursive, then by induction g∣n=gβ€²βˆ£ng|_n = g'|_n. But then g(n)=h(g∣n(nβˆ’1))=h(gβ€²βˆ£n(nβˆ’1))=gβ€²(n)g(n) = h(g|_n(n-1)) = h(g'|_n(n-1)) = g'(n).

Proof of (2): Similar, by induction on min⁑(n1,n2)\min(n_1, n_2).

Now define f=⋃Ff = \bigcup \mathcal{F}, the union of all partial recursive functions. By (2), this is well-defined as a function. By (1), for each nβˆˆΟ‰n \in \omega, there is exactly one partial recursive g:n+1β†’Ag: n+1 \to A, so f(n)f(n) is defined. Thus dom(f)=Ο‰\text{dom}(f) = \omega.

Moreover, ff satisfies the recursion equations: f(0)=af(0) = a by definition, and f(n+1)=h(f(n))f(n+1) = h(f(n)) because any partial recursive function extending to n+2n+2 must satisfy this.

Uniqueness: Suppose f,g:Ο‰β†’Af, g: \omega \to A both satisfy the recursion. Define S={nβˆˆΟ‰:f(n)=g(n)}S = \{n \in \omega : f(n) = g(n)\}. Then 0∈S0 \in S since f(0)=a=g(0)f(0) = a = g(0). If n∈Sn \in S, then f(n)=g(n)f(n) = g(n), so f(n+1)=h(f(n))=h(g(n))=g(n+1)f(n+1) = h(f(n)) = h(g(n)) = g(n+1), thus n+1∈Sn+1 \in S. By induction, S=Ο‰S = \omega, so f=gf = g.

β– 
ExampleDefining Addition by Recursion

Fix mβˆˆΟ‰m \in \omega and define f:Ο‰β†’Ο‰f: \omega \to \omega by the recursion theorem with:

  • a=ma = m
  • h(x)=S(x)=x+1h(x) = S(x) = x + 1

This gives f(0)=mf(0) = m and f(n+1)=f(n)+1f(n+1) = f(n) + 1. Denote f(n)=m+nf(n) = m + n. This defines addition for fixed mm, and we can prove m+nm + n satisfies the expected properties.

TheoremGeneral Recursion Theorem

A more general version allows the recursive step to depend on both the index and the previous value. Given a∈Aa \in A and h:ω×Aβ†’Ah: \omega \times A \to A, there exists a unique f:Ο‰β†’Af: \omega \to A with:

f(0)=af(n+1)=h(n,f(n))\begin{align*} f(0) &= a \\ f(n+1) &= h(n, f(n)) \end{align*}

The proof is similar, incorporating the index into the partial functions.

ExampleDefining Power by Recursion

To define exponentiation mnm^n, fix mm and use:

  • a=1a = 1 (since m0=1m^0 = 1)
  • h(n,y)=mβ‹…yh(n, y) = m \cdot y

Then f(0)=1f(0) = 1 and f(n+1)=mβ‹…f(n)f(n+1) = m \cdot f(n), giving f(n)=mnf(n) = m^n.

DefinitionCourse-of-Values Recursion

An even more general form allows the value at nn to depend on all previous values. Given G:Seq(A)β†’AG: \text{Seq}(A) \to A (where Seq(A)\text{Seq}(A) is the set of finite sequences from AA), there exists a unique f:Ο‰β†’Af: \omega \to A such that:

f(n)=G(f∣n)f(n) = G(f|_n)

where f∣n=⟨f(0),f(1),…,f(nβˆ’1)⟩f|_n = \langle f(0), f(1), \ldots, f(n-1) \rangle.

ExampleFibonacci Numbers

Define F:Ο‰β†’Ο‰F: \omega \to \omega by course-of-values recursion:

F(n)={0ifΒ n=01ifΒ n=1F(nβˆ’1)+F(nβˆ’2)ifΒ nβ‰₯2F(n) = \begin{cases} 0 & \text{if } n = 0 \\ 1 & \text{if } n = 1 \\ F(n-1) + F(n-2) & \text{if } n \geq 2 \end{cases}

This is formalized by defining GG appropriately on sequences: G(⟨⟩)=0G(\langle\rangle) = 0, G(⟨0⟩)=1G(\langle 0 \rangle) = 1, and G(s⌒⟨a,b⟩)=a+bG(s \smallfrown \langle a, b \rangle) = a + b for sequences ending in a,ba, b.

TheoremEquivalence of Recursion Forms

The basic recursion theorem, general recursion, and course-of-values recursion are all equivalent in the sense that each can be derived from any other. They are simply different presentations of the same fundamental property of Ο‰\omega.

Remark

The recursion theorem is not an axiom but a theorem proved from the ZFC axioms, particularly replacement and infinity. It reflects the well-founded nature of Ο‰\omega: every natural number is reached in finitely many steps from 0, so recursive definitions terminate and produce well-defined values.

ExamplePrimitive Recursive Functions

The class of primitive recursive functions consists of all functions that can be built from:

  1. Zero function: Z(n)=0Z(n) = 0
  2. Successor: S(n)=n+1S(n) = n + 1
  3. Projection: Pik(x1,…,xk)=xiP^k_i(x_1, \ldots, x_k) = x_i
  4. Composition: From gg and h1,…,hmh_1, \ldots, h_m, form f(x)=g(h1(x),…,hm(x))f(x) = g(h_1(x), \ldots, h_m(x))
  5. Primitive recursion: From gg and hh, form ff by f(x,0)=g(x)f(x, 0) = g(x) and f(x,n+1)=h(x,n,f(x,n))f(x, n+1) = h(x, n, f(x, n))

This class includes addition, multiplication, exponentiation, factorials, and many other familiar functions. However, the Ackermann function is computable but not primitive recursive, showing that recursion can go beyond primitive recursion.

The recursion theorem provides the rigorous foundation for all inductive definitions in mathematics. From defining arithmetic operations to constructing complex algorithms, recursion is indispensable, and the recursion theorem ensures that such definitions are mathematically sound.