Manifesto
One is often interested in defining functions and relations over the natural numbers. For example, one wants to define at least addition and multiplication over them. To do this, one usually specifies the value of the intended function on 0. Then, assuming that one has already defined the function for n, one proceeds to define the value of the function on S(n).
This is the basic procedure of defining a recursive function over N. First, however, one must ensure that this procedure even works — it is not immediately clear that a function so defined exists as a set.
Theorem RecDef0
Definition by Recursion 0. Let X be a set. Let x be some element of X and let φ:X→X be any function. Then, there exists a unique function f:N→X such that
- f(0)=x and
- f(S(n))=φ(f(n)).
Proof: Consider the set F of all subsets of N×X that satisfy the two conditions above i.e.
F={F⊆N×X: (0,x)∈F and (S(n),φ(Fn))∈F if (n,Fn)∈F}
This set is non-empty because the entire product set N×X itself satisfies both of the conditions of F.
Now, define f to be the intersection of all the F's in F i.e. f=⋂F={p∈U: F∈F implies p∈F}
f, thus defined, is a valid set because F is non-empty; otherwise, f would be U itself, which is not a set. Also, as all elements in F satisfy both conditions of the theorem, so must f satisfy both conditions of the theorem.
Next, one must show that f maps a given value to at most one value. Essentially, one has to show that if n∈N and y,y~∈X and (n,y),(n,y~)∈f, then y=y~. This is accomplished by induction:
- The property to be shown is true for 0. For, suppose (0,y),(0,y~)∈f. Well, (0,x)∈f also. Now, if both y and y~ are x, one is done. Otherwise, assume for the sake of a contradiction that one of them is not x. Without loss of generality let it be y which is not equal to x. Consider, now, the set f′=f∖{(0,y)}. (0,x)∈f′ because (0,x)∈f and (0,x)≠(0,y) by construction. Also, say (n,fn)∈f′. Then, (n,fn)∈f also; so since f satisfies the second condition of this theorem, (S(n),φ(fn))∈f. But as S(n)≠0 by Peano axiom 3, it must be that (S(n),φ(fn))≠(0,y); hence, (S(n),φ(fn))∈f′. Thus, f′ also satisfies the conditions of F i.e. f′∈F. But then,
f=⋂F⊆f′=f∖{(0,y)}⊂f
which is a contradiction, as f cannot be a strict subset of itself.
- Now, suppose that the property is true for some n∈N. Thus, there is one and only one fn∈X such that (n,fn)∈f. Now, consider any two (S(n),y),(S(n),y~)∈f. Certainly, (S(n),φ(fn))∈f also. Note that since φ is a function, it has to be many-to-one, so that φ(fn) refers to a unique element of X. Hence, if both y and y~ equal φ(fn), then necessarily y equals y~ and one is done. Otherwise, assume for the sake of a contradiction that one of them is not φ(fn); w.l.o.g. let this be y. Consider, now, the set f′=f∖{(S(n),y)}. (0,x)∈f′ because (0,x)∈f and (0,x)≠(S(n),y) (since 0≠S(n) by Peano axiom 3). Next, suppose (ν,fν)∈f′; then, (ν,fν)∈f so that (S(ν),φ(fν))∈f. Now, if ν=n, then by the initial assumption, there is only one fn such that (n,fn)=(ν,fn)∈f; so one must have fν=fn. Then, by construction, φ(fν)=φ(fn)≠y; so one has that (S(ν),φ(fν))≠(S(n),y). If, on the other hand, ν≠n, then, by Peano axiom 2, one has S(ν)≠S(n), so that (S(ν),φ(fν))≠(S(n),y) again. Thus, in both cases, (S(ν),φ(fν))∈f and (S(ν),φ(fν))≠(S(n),y) i.e. (S(ν),φ(fν))∈f′. Thus, f′ also satisfies the conditions of F i.e. f′∈F. But then,
f=⋂F⊆f′=f∖{(S(n),y)}⊂f
which is a contradiction.
This completes the induction to show that f is many-to-one.
To complete the demonstration that f is a function, one still needs to show that the domain and codomain of f are N and X respectively. Since the proofs needed for both are quite similar, I only demonstrate the fact that f's domain is N i.e. that
domf={n∈U: ∃χ∈X [(n,χ)∈f]}=N
Well, certainly, since f⊆N×X, domf⊆N. Now, clearly 0∈domf since (0,x)∈f. Also, if n∈domf, then there is a χ such that (n,χ)∈f; hence, (S(n),φ(χ))∈f so that S(n)∈f. Thus, by induction, N⊆domf.
Finally, I show that f is unique. To begin with, assume that there is another function f′:N→X which satisfies the conditions of this theorem. Then, in particular, f′ is a subset of N×X satisfying the conditions of F i.e. f′∈F. Hence, f=⋂F⊆f′. Next, to show that f′⊆f, suppose (n,χ~)∈f′. Then, necessarily, as f′⊆N×X, n∈N and χ~∈X. Now, certainly, as f's domain is the whole of N, there is some χ∈X such that (n,χ)∈f. Since f⊆f′, this means that (n,χ)∈f′ also. But then, as f′ is a many-to-one mapping, it must be that χ~=χ; hence, (n,χ~)∈f too.
Theorem RecDef1
Definition by Recursion 1. Let X be a set. Let x be some element of X and let φ:X×N→X be any function. Then, there exists a unique function f:N→X such that
- f(0)=x and
- f(S(n))=φ(f(n),n).
Proof Sketch: On the outset, this theorem looks more general than the previous one. After all, the previous theorem is a clear special case of this one. However, one can actually derive this theorem from the previous one. To do this, assume X, x and φ to be given as prescribed by this theorem.
Now, define X~=X×N and φ~:X~→X~ to be φ~(x,n)=(φ(x,n),S(n)). Applying the previous theorem on X~, (x,0) and φ~ yields a unique function f~:N→X~ such that
- f~(0)=(x,0) and
- f~(S(n))=φ~(f~(n))=(φ(f~(n)),S(n))
Next, one can define the required function thus: f:N∋n↦first(f~(n))∈X. Here, the function first:X~→X simply returns the first member of an ordered pair in X~=X×N i.e. first(x,n)=x. An entirely analogous function second can also be defined and using this, one can show by an easy induction that second(f~(n))=n for all n∈N.
Finally, the reader can verify that f does indeed satisfy the required conditions of the theorem.