## 4.8. More recursion tools

### Rebuilding recursion

Let us work in a first-order theory just assumed to have 3 types ℕ, E and HE, the language and axioms of arithmetic for ℕ with the schema of induction over expressible subsets of ℕ, and the axiom that H provides "all finite sequences"

n∈ℕ, ∀uH, ∀yE, ∃vH, vn=y ∧ ∀k<n, vk = uk

The following existential result has a simple proof by induction making no use of uniqueness:

R⊂ℕ×E2, ∀n∈ℕ, (∀i<n, ∀xE, ∃yE, R(i,x,y)) ⇒ ∀aE, ∃uH, u0=a ∧ ∀i<n, R(i,ui,ui+1).

Its simplicity only goes for this case, only generalizable to conditions of the form R(n,(uk)k<n,un), while the case of algebraic terms is also true but more difficult to prove.
As a particular case, comes the finite choice theorem written as

R⊂ℕ×E, ∀n∈ℕ, (∀i<n, ∃yE, R(i,y)) ⇒ ∃uH, ∀i<n, R(i,ui).

With fEℕ×E the restriction of such u to numbers ≤ n is also unique by induction, from which the xE such that x0=a ∧ ∀n∈ℕ, xn+1 = f(n,xn), can be defined by its graph

{(n,un) | (n,u)∈ℕ×H, u0=a ∧ ∀i<n, ui+1 = f(i,ui)}

As H contains any finite sequence expressible in the theory, this definition of recursion turns out to be "the recursion which the theory can express" independently of the particular choice of H.
The construction of ℕ(ℕ) from the last section, and similarly simple candidate expressions of H as a countable set, assumes recursion, thus cannot be used to define recursion by the above method. To actually provide a definition of recursion that does not assume it, requires an independent expression of an enumerated H, which is harder but finally possible. Such a construction was achieved by Godel as part of his work to prove the incompleteness theorem.

### Morphisms as subalgebras

For any L-algebras E, F, ∀fFE, f ∈ MorL(E,F) ⇔ Gr f ∈ SubL(E×F).

Proof: ∀sL,

 (∀x∈Ens, f(sE(x)) = sF(f⚬x)) ⇔ ∀x∈Ens, ∀y∈Fns, (y = f⚬x ⇒ f(sE(x)) = sF(y)) ⇔ ∀(x⊓y)∈(Gr f)ns, (sE(x), sF(y)) ∈ Gr f ⇔ ∀z∈(Gr f)ns, sE×F(z) ∈ Gr f ∎

Other proof from previous results:
f ∈ MorL(E,F) ⇔ IdEf ∈ MorL(E,E×F) ⇒ Gr f = Im(IdE×f ) ∈ SubL(E×F).
Gr f ∈ SubL(E×F) ⇒ π0|Gr f ∈ MorL(Gr f, E) ⇒ IdEf = (π0|Gr f)-1 ∈ MorL(E, Gr f) ⊂ MorL(E, E×F).∎

Hence another proof of the stability of equalizers:

f,g∈MorL(E,F), (Gr f ⋂ Gr g) ∈ SubL (E×F) ∴ {xE| f(x) = g(x)} = π0 [Gr f ⋂ Gr g] ∈ SubL E.

### Another proof of recursion

By seeing morphisms as subalgebras, we can write another construction of recursive sequences u∈Mor(0,S)(ℕ,(E,a,f)), as follows.

Let M be the minimal subalgebra of ℕ×Ea,f, and let A={n∈ℕ | ∃!xE, (n,x)∈M}.
As M is a minimal (0,S)-algebra, M = {(0,a)}∪ Im SM.
Substituting this into the definition of A we get
p∈ℕ, pA ⇔ (∃!yE, (p=0 ∧ y=a)∨∃(n,x)∈M, (p=Sny=f(x))).
From 0 ∉ Im S we get 0∈A, and
n∈ℕ, SnA ⇔ ∃!yE, ∃(n',x)∈M, (Sn=Sn'y=f(x)).
From the injectivity of S we get
n∈ℕ, SnA ⇔ ∃!yE, ∃xE, (n,x)∈My=f(x).
Thus (∀nA, SnA), so that A = ℕ, i.e. M is the graph of a function uE. As M ∈ Sub(ℕ×Ea,f), we conclude u ∈ Mor(0,S)(ℕ,Ea,f).

### Injectivity lemma

If E is a surjective partial L-algebra and F is an injective L-system then ∀f ∈MorL(E,F),
1. A = {xE | ∀yE, f(x) = f(y) ⇒ x=y} ∈ SubLE.
2. B = {yF | !: f(y)} ∈ SubLF
Thus if more precisely E, F are algebras, {yF | ∃!: f(y)} ∈ SubLF.
While they are almost the same, let us write separate proofs.
The condition f ∈MorL(E,F) is read Im f ⊂ Dom ψFLf|Dom φE = ψFf⚬φE.
1. xLA⋂Dom φE, ∀yE, ∃z∈φE(y),
fE(x)) = f(y) ⇒ Lf(x) = ψF(fE(x))) = ψF(f(y)) = ψF(fE(z))) = Lf(z)
x = z ⇒ φE(x) = y.
2. yF*(LB), ψF(y) ∈ LB ∴ (!z∈Dom φE, ψF(y) = Lf(z) = ψF(fE(z))))
∴ !x∈Im φE=E, y = f(x).∎

### A more general form of recursion

Some useful sequences need recursive definitions where the term defining uSn uses not only un but also n itself. Somehow it would work all the same, but trying to directly adapt to this case the proof we gave would require to define some special generalizations of previous concepts, and specify their resulting properties. To simplify, let us proceed another way, similar to the argument in Halmos's Naive Set Theory, but generalized.
For any algebraic language L, let us introduce a general concept of "recursive condition" for functions u : EF, where, instead of a draft, E is first assumed to be an L-algebra (then a ground term algebra to conclude).
The version we saw was formalized by giving the term in the recursive definition as an L-algebra structure on F, φF: LFF, then expressing the request for u to satisfy this condition as u∈Mor(E,F), namely

∀(s,x)∈LE, u(sE(x)) = φF(s,ux).

Let us generalize this as u(sE(x)) = φ(s,x,ux) which by the canonical bijection Dom φ ≡ ∐sL Ens ×Fns ≡ ∐sL (E×F)ns = L⋆(E×F) can be written using h : L⋆(E×F) → F such that ∀(s,x,y)∈ Dom φ, φ(s,x,y) = h(s,xy), as

u(sE(x)) = h(s,x⊓(ux)).

As ∀uFE, x⊓(ux) = (IdEu)⚬x, this becomes the second component of the formula IdEu ∈ Mor(E, E×F) when giving E×F the structure φE×F = (φE⚬πL)⊓h.
The first component (φE⚬πL) we give to φE×F, makes π∈ Mor(E×F, E) and makes tautological the first component of the formula IdEu ∈ Mor(E, E×F), namely
IdE(sE(x)) = φE(s,x) = (φE⚬πL)(s,x⊓(ux)).
It is then possible to conclude by re-using the previous result of existence of interpretations:
If E is a closed term L-algebra then ∃!f ∈ Mor(E, E×F), which is of the form IdEu because π⚬f ∈ Mor(E, E) ∴ π⚬f = IdE.
But one can do without it, based on the following property of this L-algebra E×F:

uFE, IdEu ∈ MorL(E, E×F) ⇔ Gr u ∈ SubL(E×F)

Indeed the defining formulas of both sides coincide. To see it otherwise,
• ⇒ is a case of image of an algebra by a morphism, Gr u = Im (IdEu).
• For the converse, the inverse of the bijective morphism π|Gr u ∈ MorL(Gr u, E) is a morphism IdEu ∈ MorL(E, Gr u) ⊂ MorL(E, E×F).
This reduces the issue to the search of subalgebras of E×F which are graphs of functions from E to F.
Now if E is a ground term L-algebra then M = MinL(E×F) is one of them because π|M∈ MorL(M, E) from a surjective algebra to a ground term algebra must be bijective.
Any other subalgebra of E×F must include M, thus to stay functional it must equal M. ∎
Set theory and foundations of mathematics
1. First foundations of mathematics
2. Set theory (continued)
3. Algebra 1
4. Arithmetic and first-order foundations
4.1. Algebraic terms
4.2. Quotient systems
4.3. Term algebras
4.4. Integers and recursion
4.5. Presburger Arithmetic
4.6. Finiteness and countability (draft)
4.7. The Completeness Theorem
4.8. More recursion tools
4.9. Non-standard models of Arithmetic
4.10. Developing theories : definitions
4.11. Constructions