Logic and Computability
Daniel Naylor

Contents

1Non-classical Logic
1.1Intuitionistic Logic
1.2The simply typed λ-calculus
1.3The Curry-Howard Correspondence
1.4Semantics for IPC
1.5Negative translations
2Computability
2.1Recursive functions and λ-computability
2.2Decidability in Logic
Index

1 Non-classical Logic

There are no non-experienced truths – L.E.J. Brouwer

1.1 Intuitionistic Logic

Idea: a proof of φ ψ is a “procedure” that comments a proof of φ into a proof of ψ.

In particular, ¬¬φ is not always the same as φ.

Fact: The law of excluded middle (φ ¬φ) is not generally intuitionistically valid.

Moreover, the Axiom of Choice is incompatible with intuitionistic set theory.

We take choice to mean that any family of inhabited sets admits a choice function.

Theorem 1.1.1 (Diaconescu). The law of excluded middle can be intuitionistically deduced from the Axiom of Choice.

Proof. Let φ be a proposition. By the Axiom of Separation, the following are sets (i.e. we can construct a proof that they are sets):

A := {x {0,1} : φ (x = 0)}B := {x {0,1} : φ (x = 1)}.

As 0 A and 1 B, we have that {A,B} is a family of inhabited sets, thus admits a choice function f : {A,B} A B by the Axiom of Choice. This satisfies f(A) A and f(B) B by definition.

Thus we have

(f(A) = 0 φ) (f(B) = 1 φ)

and f(A),f(B) {0,1}. Now f(A) {0,1} means that (f(A) = 0) (f(A) = 1) and similarly for f(B).

We can have the following:

So we can always specify a proof of φ or a proof of φ or a proof of ¬φ.

Why bother?

Let’s try to formalise the BHK interpretation of logic.

We will inductively define a provability relation by enforcing rules that implement the BHK interpretation.

We will use the notation Γ φ to mean that φ is a consequence of the formulae in the set Γ.

Rules for Intuitionistic Propositional Calculus (IPC)

We obtain classical propositional logic (CPC) by adding either:

By

[A] X [B] Y C (A,B)

we mean ‘if we can prove X assuming A and we can prove Y assuming B, then we can infer C by “discharging / closing” the open assumptions A and B’.

In particular, the ( -I)-rule can be written as

Γ,[A] B Γ A B (A).

We obtain intiuitionistic first-order logic (IQC) by adding rules for quantification:

Example 1.1.2. Let’s give a natural deduction proof of A B B A.

[AB] A [AB] B BA A B B A (A B).

Example 1.1.3. Let’s prove the Hilbert-style axioms φ (ψ φ) and (φ (ψ χ)) ((φ psi) (φ χ)).

[φ]  [ψ] ψφ (ψ) φ (ψ φ) (φ)

[φ (ψ χ)][φ ψ][φ]   (toE)


ψ χψ   (toE)


χ   (toI,ψ)


φ χ   (toI, φψ)


(φ ψ) (φ χ)   (toI, (φ(ψχ)))


(φ (ψ χ)) ((φ ψ) (φ χ))

If Γ is a set of propositions in the language and φ is a proposition, we write Γ IPCφ, Γ IQCφ, Γ CPCφ, Γ CQCφ, if there is a proof of φ from Γ in the respective logic.

Lemma 1.1.4. Assuming that:

  • Γ IPCφ

  • ψ a proposition

Then Γ,ψ IPCφ. Moreover, if p is a primitive proposition and ψ is any proposition, then
Γ[p := ψ] IPCφ[p := ψ].

Proof. Induction over the size of proofs.

1.2 The simply typed λ-calculus

For now we assume given a set Π of simple types generated by a grammar

Π := U|Π Π,

where U is a countable set of type variables, as well as an infinite set V of variables.

Definition 1.2.1 (Simply typed lambda-term). The set ΛΠ of simply typed λ-terms is defined by the grammar

ΛΠ := V variables|λV : Π.ΛΠ λ-abstraction|ΛΠΛΠ λ-application.

A context is a set of pairs {x1 : τ1,,xn : τn} where the xi are (distinct) variables and each τi Π. We write C for the set of all possible contexts. Given a context Γ C, we also write Γ,x : τ for the context Γ {x : τ} (if x does not appear in Γ).

The domain of Γ is the set of variables that occur in it, and the range |Γ| is the set of types that it manifests.

Definition 1.2.2 (Typability relation). We define the typability relation C ×ΛΠ ×Π via:

  • (1)
    For every context Γ, and variable x not occurring in Γ, and type τ, we have Γ,x : τ x : τ.
  • (2)
    Let Γ be a context, x a variable not occurring in Γ, and let σ,τ Π be types, and M be a λ-term. If Γ,x : σ M : τ, then Γ (λx : σ.M) : (σ τ).
  • (3)
    Let Γ be a context, σ,τ Π be types, and M,N ΛΠ be terms. If Γ M : (σ τ) and Γ N : σ, then Γ (MN) : τ.

Notation. We will refer to the λ-calculus of ΛΠ with this typability relation as λ().

A variable x occurring in a λ-abstraction λx̲ : σ.M is bound, and it is free otherwise. We say that terms M and N are α-equivalent if they differ only in the names of the bound variables.

If M and N are λ-terms and x is a variable, then we define the substitution of N for x in M by:

Definition 1.2.3 (beta-reduction). The β-reduction relation is the smallest relation β on ΛΠ closed under the following rules:

  • (λx : σ.P)Q βP[x := Q],

  • if P βP, then for all variables x and types σ Π, we have λx : σ.P βλx : σ.P,

  • P βP and z as a λ-term, then PZ βPZ and ZP βZP.

We also define β-equivalence β as the smallest equivalence relation containing β.

Example 1.2.4 (Informal). We have (λx : .(λy : τ.x))Zβ(λy : τ.Z).

When we reduce (λx : σ.P)Q, the term being reduced is called a β-redex, and the result is its β-contraction.

Lemma 1.2.5 (Free variables lemma). Assuming that:

  • ΓM : σ

Then
  • (1) If Γ Γ, then ΓM : σ.
  • (2) The free variables of M occur in Γ.
  • (3) There is a context ΓΓ comprising exactly the free variables in M, with ΓM : σ.

Proof. Exercise.

Lemma 1.2.6 (Generation Lemma).

  • (1)
    For every variable x, context Γ, and type σ, if Γx : σ, then x : σ Γ;
  • (2)
    If Γ(MN) : σ, then there is a type τ such that ΓM : τ σ and ΓN : τ;
  • (3)
    If Γ(λx.M) : σ, then there are types τ and ρ such that Γ,x : τM : ρ and σ = (τ ρ).

Lemma 1.2.7 (Substitution Lemma).

  • (1)
    If ΓM : σ and α is a type variable, then Γ[α := τ]M : σ[α := τ];
  • (2)
    If Γ,x : τM : σ and ΓN : τ, then ΓM[x := N] : σ.

Proposition 1.2.8 (Subject reduction). Assuming that:

  • ΓM : σ

  • MβN

Then ΓN : σ.

Proof. By induction on the derivation of MβN, using Lemma 1.2.6 and Lemma 1.2.7.

Notation. We will write M βN if M reduces to N after (potentially multiple) β-reductions.

Theorem 1.2.9 (Church-Rosser for lambda(->)). Assuming that:

  • ΓM : σ

  • MβN1

  • MβN2

Then there is a λ-term L such that N1βL, N2βL, and ΓL : σ.

Pictorially:

          M


  N1               N2


ββββ         L

Definition (beta-normal form). A λ-term M is in β-normal form if there is no term N such that MβN.

Corollary 1.2.10 (Uniqueness of normal form). If a simply typed λ-term admits a β-normal form, then it is unique.

Proposition 1.2.11 (Uniqueness of types).

  • (1)
    If ΓM : σ and ΓM : τ, then σ = τ.
  • (2)
    If ΓM : σ, ΓN : τ, and MβN, then σ = τ.

Proof.

Example 1.2.12. There is no way to assign a type to λx : x.x. If x is of type τ, then in order to apply x to x, it has to be of type τ σ for some σ. But ττ σ.

PIC

Definition 1.2.13 (Height). The height function is the recursively defined map h : Π that maps a type variable to 0, and a function type σ τ to 1 + max (h(σ),h(τ)).

We extend the height function from types to β-redexes by taking the height of its λ-abstraction.

Not.: (λx : σ.Pτ)στRσ.

Theorem 1.2.14 (Weak normalisation for lambda(->)). Assuming that:

  • ΓM : σ

Then there is a finite reduction path M := M0βM1βM2ββMn, where Mn is in β-normal form.

Proof (“Taming the Hydra”). The idea is to apply induction on the complexity of M. Define a function m : ΛΠ × by

m(M) = { (0,0) if M is in β-normal form (h(M),redex(M))otherwise ,

where h(M) is the greatest height of a redex in M, and redex(M) is the number of redexes in M of that height.

We will use induction over ω × ω to show that if M is typable, then it admits a reduction to β-normal form.

Problem: reductions can copy redexes or create new ones.

Strategy: always reduce the right most redex of maximum height.

We will argue that by following this strategy, any new redexes we generate have to be lower than the height of the redex we picked to reduce.

PIC

If ΓM : σ and M is already in β-normal form, then claim is trivially true. If M is not in β-normal form, let Δ be the rightmost redex of maximal height h.

By reducing Δ, we may introduce copies of existing redexes, or create new ones. Creation of new redexes of Δ has to happen in one of the following ways:

Now Δ itself is gone (lowering the count by 1), and we just showed that any newly created redexes have height < h.

If we have Δ = (λx : τ.Pρ)Qτ and P contains multiple free occurrences of x, then all the redexes in Q are multiplied when performing β-reduction.

However, our choice of Δ ensures that the height of any such redex in Q has height < h, as they occur to the right of Δ in M. It is this always the case that m(M) < m(M) (in the lexicographic order), so by the induction hypothesis, M can be reduced to β-normal form (and thus so can M).

Theorem 1.2.15 (Strong Normalisation for lambda(->)). Assuming that:

  • ΓM : σ

Then there is no infinite reduction sequence MβM1β.

Proof. See Example Sheet 1.

1.3 The Curry-Howard Correspondence

Propositions-as-types: idea is to think of φ as the “type of its proofs”.

The properties of the STλC match the rules of IPC rather precisely.

First we will show a correspondence between λ() and the implication fragment IPC() of IPC that includes only the connective, the axiom scheme, and the (I) and (E) rules. We will later extend this to the whole of IPC by introducing more complex types to λ().

Start with IPC() and build a STλC out of it whose set of type variables U is precisely the set of primitive propositions of the logic.

Clearly, the set Π of types then matches the set of propositions in the logic.

Comment: λx : σ.(Mx) ηM if x is not free in M.

Proposition 1.3.1 (Curry-Howard for IPC(->)). Assuming that:

  • Γ is a context for λ()

  • φ a proposition

Then
  • (1) If ΓM : φ, then |Γ| = {τ Π : (x : τ) Γ for some x}IPC( )φ
  • (2) If |Γ|IPC( )φ, then there is a simply typed λ-term M λ() such that {(xψ : ψ)|ψ Γ}M : φ.

Proof.

Example 1.3.2. Let φ,ψ be primitive propositions. The λ-term

λf : (φ ψ) φ.λ : φ ψ.g(fg φ)ψ

has type ((φ ψ) φ) ((φ ψ) ψ), and therefore encodes a proof of that proposition in IPC( ).

g : φ ψ, f : (φ ψ) φ.

g : [φ ψ]f : [(φ ψ) φ]   (toE)


fg : φg : [φ ψ]   (toE)


g(fg) : ψ   (toI, φψ)


λg.g(fg) : (φ ψ) ψ   (toI, (φψ) φ)


λf.λg.g(fg) : ((φ ψ) φ) ((φ ψ) ψ)

Definition 1.3.3 (Full STlambdaC). The types of the full simply typed λ-calculus are generated by the following grammar:

Π := U|Π Π|Π ×Π|Π + Π|0|1,

where U is a set of type variables (usually countable).

Its terms are given by ΛΠ given by:

ΛΠ := V |λV : Π.ΛΠ|ΛΠΛΠ|Π1(ΛΠ)|Π2(ΛΠ)|ι1(ΛΠ)|ι2(ΛΠ)|case (ΛΠ;V.ΛΠ;V.ΛΠ)||!ΠΛΠ,

where V is an infinite set of variables, and is a constant.

We have new typing rules:

They come with new reduction rules:

When setting up Curry-Howard with these new types, we let:

Example 1.3.4. Consider the following proof of (φ χ) (ψ φ):

[φχ] φ [ψ]   ()


ψ φ   ()


(φ χ) (ψ φ)

We decorate this proof by turning the assumptions into variables and following the Curry-Howard correspondence:

[φχ]:p φ:π1(p)[ψ] : b   ()


ψ φ : λb : ψ.π1(p)   ()


(φ χ) (ψ φ)

STλC IPC


(primitive) types (primitive) propositions
variable hypothesis
STλ-term proof
type constructor logical connective
term inhabitation provability
term reduction proof normalisation

1.4 Semantics for IPC

Definition 1.4.1 (Lattice). A lattice is a set L equipped with binary commutative and associative operations and that satisfy the absorption laws:

a (a b) = a;a (a b) = a,

for all a,b L.

A lattice is:

  • Distributive if a (b c) = (a b) (a c) for all a,b,c L.

  • Bounded if there are elements , L such that a = a and a = a.

  • Complemented if it is bounded and for every a L there is a L such that a a = and a a = .

A Boolean algebra is a complemented distributive lattice.

Note that and are idempotent in any lattice. Moreover, we can define an ordering on L by setting a b if a b = a.

Example 1.4.2.

Proposition 1.4.3. Assuming that:

  • is the order induced by the operations in L (a b if a b = a)

Then is a partial order with least element , greatest element , and for any a,b L, we have a b = inf {a,b} and a b = sup {a,b}. Conversely, every partial order with all finite infs and sups is a bounded lattice.

Proof. Exercise.

Classically, we say that Γt if for every valuation v : L {0,1} with v(p) = 1 for all p Γ we have v(t) = 1.

We might want to replace {0,1} with some other Boolean algebra to get a semantics for IPC, with an accompanying Completeness Theorem. But Boolean algebras believe in the Law of Excluded Middle!

Definition 1.4.4 (Heyting algebra). A Heyting algebra is a bounded lattice equipped with a binary operation : H × H H such that

a b ca (b c)

for all a,b,c L.

A morphism of Heyting algebras is a function that preserves all finite meets, finite joins, and .

Example 1.4.5.

Definition 1.4.6 (Valuation in Heyting algebras). Let H be a Heyting algebra and L be a propositional language with a set P of primitive propositions. An H-valuation is a function v : P H, extended to the whole of L recursively by setting:

  • v() = ,

  • v(A B) = v(A) v(B),

  • v(A B) = v(A) v(B),

  • v(A B) = v(A)v(B).

A proposition A is H-valid if v(A) = for all H-valuations v, and is an H-consequence of a (finite) set of propositions Γ if v( Γ) v(A) for all H-valuations v (written ΓHA).

Lemma 1.4.7 (Soundness of Heyting semantics). Assuming that:

Then Γ IPCA implies ΓHA.

Proof. By induction over the structure of the proof Γ A.

Example 1.4.8. The Law of Excluded Middle is not intuitionistically valid. Let p be a primitive proposition and consider the Heyting algebra given by the topology {,{1},{1,2}} on {1,2}.

We can define a valuation v with v(p) = {1}, in which case v(¬p) = ¬{1} = int (X {1}) = .

So v(p ¬p) = {1} = {1}. Thus Soundness of Heyting semantics implies that IPCp ¬p.

Example 1.4.9. Peirce’s Law ((p q) p) p is not intuitionistically valid.

Take the valuation on the usual topology of 2 that maps p to 2 {(0,0)} and q to .

Classical completeness: Γ CPCA if and only if Γ2A.

Intuitionistic completeness: no single finite replacement for 2.

Definition (Lindenbaum-Tarski algebra). Let Q be a logical doctrine (CPC, IPC, etc), L be a propositional language, and T be an L-theory. The Lindenbaum-Tarski algebra FQ(T) is built in the following way:

  • The underlying set of FQ(T) is the set of equivalence classes [φ] of propositions φ, where φ ψ when T,φ Qψ and T,ψ Qφ;

  • If is a logical connective in the fragment Q, we set [φ][ψ] := [φψ] (should check well-defined: exercise).

We’ll be interested in the case Q = CPC, Q = IPC, and Q = IPC {}.

Proposition 1.4.10. The Lindenbaum-Tarski algebra of any theory in IPC {} is a distributive lattice.

Proof. Clearly, and inherit associativity and commutativity, so in order for FIPC{}(T) to be a lattice we need only to check the absorption laws:

[φ] [φ ψ] = [φ] (α) [φ] [φ ψ] = [φ] (β)

Equation (α) is true since T,φ IPC{}φ (φ ψ) by (-I), and also T,φ (φ ψ) IPC{}φ by (-E). Equation (β) is similar.

Now, for distributivity: T,φ (ψ χ) (φ ψ) (φ χ) by (-E) followed by (-E):

φ (ψ χ)   (-E)


φψ χ   (-E)


(φ ψ) (φ χ)

Conversely, T,((φ ψ) (φ χ)) φ (ψ χ) by (-E) followed by (-I).

Lemma 1.4.11. The Lindenbaum-Tarski algebra of any theory relative to IPC is a Heyting algebra.

Proof. We already saw that FIPC(T) is a distributive lattice, so it remains to show that [φ][ψ] := [φ ψ] gives a Heyting implication, and that FIPC(T) is bounded.

Suppose that [φ [ψ] [χ], i.e. τ,φ ψ IPCχ. We want to show that [φ] [ψ χ], i.e. τ,φ (ψ χ). But that is clear:

φ[ψ]  


φ ψ   (hyp)


χ   ( -I, ψ)


ψ χ

Conversely, if τ,φ (ψ χ), then we can prove τ,φ ψ χ:

φ ψ   (-E)


φψ   (hyp)


ψ χψ   ( -E)


χ

So defining [φ][ψ] := [φ ψ] provides a Heyting .

The bottom element of FIPC(T) is just []: if [φ] is any element, then T,IPCφ by -E.

The top element is := [: if φ is any proposition, then [φ] [] via

φ[]   (-E)


 


Theorem 1.4.12 (Completeness of the Heyting semantics). A proposition is provable in IPC if and only if it is H-valid for every Heyting algebra H.

Proof. One direction is easy: if IPCφ, then there is a derivation in IPC, thus v(φ) for any Heyting algebra H and valuation v, by Soundness of Heyting semantics. But then v(φ) = and φ is H-valid.

For the other direction, consider the Lindenbaum-Tarski algebra F(L) of the empty theory relative to IPC, which is a Heyting algebra by Lemma 1.4.11. We can define a valuation v by extending P F(L), p[p] to all propositions.

As v is a valuation, it follows by induction (and the construction of F(L)) that v(φ) = [φ] for all propositions.

Now φ is valid in every Heyting algebra, and so is valid in F(L) in particular. So v(φ) = = [φ], hence IPCφ, hence IPCφ.

Given a poset S, we can construct sets a := {s S : a s} called principal up-sets.

Recall that U S is a terminal segment if a U for each a U.

Proposition 1.4.13. If S is a poset, then the set T(S) = {U S : U is a terminal segment of S} can be made into a Heyting algebra.

Proof. Order the terminal segments by . Meets and joins are and , so we just need to define . If U,V T(S), define (UV ) := {s S : (s) U V }.

If U,V,W T(S), we have

W (UV )(w) U V w W,

which happens if for every w W and u U we have w uu V . But W is a terminal segment, so this is the same as saying that W U V .

Definition 1.4.14 (Kripke model). Let P be a set of primitive propositions. A Kripke model is a tuple (S,,) where (S,) is a poset (whose elements are called “worlds” or “states”, and whose ordering is called the “accessibility relation”) and S × P is a binary relation (“forcing”) satisfying the persistence property: if p P is such that s p and s s, then s p.

Every valuation v on T(S) induces a Kripke model by setting sp is s v(p).

Definition 1.4.15 (Forcing relation). Let (S,,) be a Kripke model for a propositional language. We define the extended forcing relation inductively as follows:

  • There is no s S with s;

  • sφ ψ if and only if sφ and sψ;

  • sφ ψ if and only if sφ or sψ;

  • s(φ ψ) if and only if sφ implies sψ for every s s.

It is easy to check that the persistence property extends to arbitrary propositions.

Moreover:

Notation. S φ for φ a proposition if all worlds in S force φ.

Example 1.4.16. Consider the following Kripke models:

In (1), we have s¬p, since s s and sp. We also know that sp, thus sp ¬p.

It is also the case that s¬¬p, yet sp, so s(¬¬p p) either.

In (2), s¬¬p since s s can’t access a world that forces p. Also s¬p either, as s s forces p. So s¬¬p ¬p.

In (3), s(p q) (¬p q). All worlds force p q, and sq. So to check the claim we just need to verify that s¬p. But that is the case, as s s and sp.

Definition 1.4.17 (Filter). A filter F on a lattice L is a subset of L with the following properties:

  • F

  • F is a terminal segment of L (i.e., if f x and f F, then x F)

  • F is closed under finite meets

Example 1.4.18.

A filter is proper if FL.

A filter F on a Heyting algebra is prime if it is proper and satisfies: whenever (x y) F, we can conclude that x F or y F.

If F is a proper filter and xF, then there is a prime filter extending F that still doesn’t contain x (by Zorn’s Lemma).

Lemma 1.4.19. Assuming that:

Then there is a Kripke model (S,,) such that vHφ if and only if Sφ, for every proposition φ.

Proof (sketch). Let S be the set of all prime filters of H, ordered by inclusion. We write Fp if and only if v(p) F for primitive propositions p.

We prove by induction that Fφ if and only if v(φ) F for arbitrary propositions.

For the implication case, say that F(ψ ψ) and v(ψ ψ) = [v(ψ)v(ψ)]F. Let G be the least filter containing F and v(ψ). Then

G = {b : (f F)(f v(ψ) b)}.

Note that v(ψ)G, or else f v(ψ) v(ψ) for some f F, whence f v(ψ ψ) and so v(ψ ψ) F (as F is a terminal segment).

In particular, G is proper. So let G be a prime filter extending G that does not contain v(ψ) (exists by Zorn’s lemma).

By the induction hypothesis, Gψ, and since F(ψ ψ) and G (this G) contains F, we have that Gψ. But then v(ψ) G, contradiction.

This settles that F(ψ ψ) implies v(ψ ψ) F.

Conversely, say that v(ψ ψ) F Gψ. By the induction hypothesis, v(ψ) G, and so v(ψ)v(ψ) G (as F G). But then v(ψ) v(ψ) (v(ψ)v(ψ)) G, as G is a filter.

So the induction hypothesis gives Gψ, as needed.

The cases for the other connectives are easy ( needs primality). So (S,,) is a Kripke model. Want to show that vHφ if and only if Sφ, for each φ.

Conversely, say Sφ, but vHφ. Since v(φ), there must be a proper filter that does not contain it. We can extend it to a prime filter G that does not contain it, but then Gφ, contradiction.

Theorem 1.4.20 (Completeness of the Kripke semantics). Assuming that:

  • φ a proposition

Then Γ IPCφ if and only if for all Kripke models (S,,), the condition SΓ implies Sφ.

Proof. Soundness: induction over the complexity of φ.

Adequacy: Say Γ IPCφ. Then vHΓ but vHφ for some Heyting algebra H and H-valuation v (Theorem 1.4.12). But then Lemma 1.4.19 applied to Hand v provides a Kripke model (S,,) such that SΓ, but Sφ, contradicting the hypothesis on every Kripke model.

1.5 Negative translations

Definition 1.5.1 (Double-negation translation). We recursively define the ¬¬-translation φN of a proposition φ in the following way:

  • If p is a primitive proposition, then pN := ¬¬p;

  • (φ ψ)N := φN ψN

  • (φ ψ)N := φN ψN

  • (φ ψ)N := ¬(¬φN ¬ψN)

  • (¬φ)N := ¬φN

Lemma 1.5.2. Assuming that:

Then the map ¬¬ : H H preserves and .

Proof. Example Sheet 2.

Lemma 1.5.3 (Regularisation). Assuming that:

Then

Proof.

In particular, if S is a set, then FHeyt(S)¬¬FBool(S).

Theorem 1.5.4 (Glivenko’s Theorem). Assuming that:

  • φ and ψ are propositions

Then CPCφ ψ if and only if IPC¬¬φ ¬¬ψ.

Proof.

Corollary 1.5.5. Assuming that:

  • φ a proposition

Then CPCφ if and only if IPCφN.

Proof. Induction over the complexity of formulae.

Corollary 1.5.6. CPC is inconsistent if and only if IPC is inconsistent.

Proof.

2 Computability

“If a ‘religion’ is defined to be a system of ideas that contains improvable statements, then Gödel taught us that mathematics is not only a religion; it is the only religion that can prove itself to be on.” – John Barrow

2.1 Recursive functions and λ-computability

Definition 2.1.1 (Partial recursive function). The class of recursive functions is the smallest class of partial functions of the form k that contains the basic functions:

  • Projections: Πim : (n1,,nm)ni;

  • Successor: S+ : nn + 1;

  • Zero: z : n0

and is closed under:

  • Compositions: if g : k is partial recursive and so are h1,,hk : m , then the function f : m given by f(n¯) = g(h1(n¯),,hk(n¯)) is partial recursive.

  • Primitive recursion: Given partial recursive functions g : m and h : m+2 , the function f : m+1 defined by

    { f(0,n¯) := g(n¯) f(k + 1,n¯) := h(f(k,n¯),k,n¯)

  • Minimisation: Suppose g : m+1 is partial recursive. Then the function f : m that maps n¯ to the least n such that g(n,n¯) = 0 (if it exists) is partial recursive.

    Notation: f(n¯) = μn.g(n,n¯) = 0.

The class of functions produced by the same conditions but excluding minimisation is called the class of primitive recursive functions.

A partial recursive function that is defined everywhere is called a total recursive function.

The terms of the untyped λ-calculus Λ are given by the grammar

Λ := V |λV.Λ|ΛΛ,

where V is a (countable) set of variables.

The notions we previously discussed (α-equality, β-reduction, η-reduction, etc) apply tit for tat.

Example 2.1.2. Let ω := λx.xx and Ω := ωω. Then Ω = (λx.xx)ωβωω = Ω. This shows that we can have an infinite reduction chain of λ-terms.

Question: If MβN, MβN, do we have NβM and NβM for some M?

Idea: “Simultaneously reduce” all the redexes in M to get a term M. This might have new redexes, so we can iterate the process to get terms M2,M3,.

M should reduce to M, so we have MβMβM2,. We’ll see that if M reduces to N in k steps, then NβMk.

Using this, we will show (assuming s r):

           M

  N2                 N1


                     M r∗

             s∗
srβββββ         M

To get there, we want to build M with two properties:

Definition 2.1.3 (Takahashi Translation). The Takahashi translation M of a λ-term M is recursively defined as follows:

  • (1)
    x:= x, for x a variable;
  • (2)
    If M = (λx.P)Q is a redex, then M:= P[x := Q];
  • (3)
    If M = PQ is a λ-application, then M:= PQ;
  • (4)
    If M = λx.P is a λ-abstraction, then M:= λx.P.

These rules are numbered by order of precedence, in case of ambiguity. We also define M0:= M and M(n+1):= (Mn).

Note that M is not necessarily in β-normal form, for example if M = (λx.xy)(λy.y), then

M = (xy)[x := (λy.y)] = (xy)[x := λy.y] = (λy.y)y.

Lemma 2.1.4. Assuming that:

Then
  • (1)
    FV (M) FV (M);
  • (2)
    MβM;
  • (3)
    If MβN, then NβM.

Proof. Induction over the structure of λ-terms.

Lemma 2.1.5. Takahashi translation preserves β-contraction:

((λx.P)Q) β(P[x := Q]).

Proof. By definition, ((λx.P)Q) = P[x := Q]. By induction over the structure of P, we can check that:

Lemma 2.1.6. Assuming that:

  • MβN

Then MβN.

Proof. Induction over the structure of M. We’ll leave the easier cases as exercises, and focus on when M is a redex, or when M = P1P2, where P1 is not a λ-abstraction and N = Q1P2 with P1βQ1.

Suppose that M = (λx.P1)P2 is a redex. Then there are three possibilities for N.

Now suppose M = P1P2, where P1 is not a λ-abstraction, and N = Q1P2 with P1βQ1. Here M = P1P2. If Q1 is not a λ-abstraction, the result is clear. So let Q1 = λy.R. Applying the induction hypothesis to P1βλy.R, we get P1βλy.R. Thus

M = P 1P 2 β(λy.R)P 2 βR[y := P 2] = N.

Corollary 2.1.7. If MβN, then MβN.

Proof. Induction over the length of the chain MβN, using Lemma 2.1.6.

Applying this multiple times, MβN implies MnβNn for all n < ω.

Theorem 2.1.8. Assuming that:

Then NβMn.

Proof. By induction over n. The base case is clear, as n = 0 implies M = N.

For n > 0, there is a term R with MβR (n1)βN. By induction hypothesis, NβRn1. Since MβR, we have RβM by Lemma 2.1.4. Thus we get Rn1βMn by the previous observation. Putting it all together:

NβRn1 βMn.

Theorem 2.1.9 (Church, Rosser, 1936). Assuming that:

  • M,N1,N2 are λ-terms such that MβN1,N2

Then there is a λ-term N such that N1,N2βN.

Proof. Say M rβN1, M sβN2. Without loss of generality, say r s. By Theorem 2.1.8, we have that N1βMr and N2βMs. But MrβMs by successive applications of Lemma 2.1.4 (as r s). So take N = Ms.

Reminder of the picture to think of:

           M


  N2                 N1

                       r∗
                     M

srβββββ         M s∗

This has some important consequences:

Example. λx.x and λx.λy.x are different terms in β-normal form, so they can’t be β-equivalent.

Definition 2.1.10 (Church numeral). Let n be a natural number. Its corresponding Church numeral cn is the λ-term cn := λs.λz.sn(z), where sn(z) denotes

s(s((sn timesz)).

Example 2.1.11. c0 = λs.λz.z is the ‘function’ that takes s to the identity map.

c1 = λs.λz.λs(z) is the ‘function’ that takes s to itself.

c2 = λs.λz.ss(z) takes a function s to its 2-fold composite zs(s(z)).

Definition 2.1.12 (lambda-definability). A partial function f : k is λ-definable if there is a λ-term F such that Fcn1cnkβcf(n1,,nk).

Proposition 2.1.13 (Rosser). Define the following λ-term:

  • A+ := λx.λy.λs.λz.xs(ys(z)),

  • A:= λx.λy.λs.x(ys),

  • Ae := λx.λy.yx.

Then for all n,m :

  • A+cncmβcn+m;

  • Acncmβcnm;

  • Aecncmβcnm if m > 0.

Proof. We’ll show that A+cncmβcn+m, and leave the rest to you.

First note that

c n sz = (λf.λx.fn(x))sz β(λx.sn(x))z βsn(z).

So:

A+cncm = (λx.λy.λs.λz.xs(ysz))cncm β(λy.λs.λz.cns(ysz))cm βλs.λz.cns(cmsz)) βλs.λz.sn(smz) βλs.λz.sn(smz) βλs.λz.sm+n(z) βcn+m

In a similar fashion, we can also encode binary truth-values:

Proposition 2.1.14. Define the λ-terms:

  • := λx.λy.x

  • := λx.λy.y

  • (if B then P else Q := BPQ)

Then for λ-terms P and Q, we have

  • (i)
    (if  then P else Q)βP;
  • (ii)
    (if  then P else Q)βQ.

Proof. Just compute it!

With this, we can encode logical connectives via:

We can also encode pairs: if we define [P,Q] := λx.xPQ, then [P,Q]βP and [P,Q]βQ. However, it is not true that [M,M]βM!

Recursively defining terms within the λ-calculus requires a clever idea: we see such a term as a solution to a fixed point equation F = λx.M where F occurs somewhere in M.

Theorem 2.1.15 (Fixed Point Theorem). There is a λ-term Y such that, for all F:

F(Y F)βY F.

Proof. Define

Y = λf.(λx.f(xx))λx.f(xx).

If we compute Y F, we get:

Y F = (λf.(λx.f(xx))λx.f(xx))F β(λx.F(xx))λx.F(xx) βF((λx.F(xx))(λx.F(xx))) βF((λf.(λx.f(xx))λx.f(xx))F) βF(Y F)

We call any combinator (i.e. a λ-term without free variables) Y satisfying the property F(Y F)βY F for all terms F a fixed-point combinator.

Corollary 2.1.16. Given a λ-term M, there is a λ-term F such that FβM[f := F].

Proof. Take F = Y λf.M. Then

Fβ(λf.M)Y (λf.M)β(λf.M)FβM[f := F].

Example 2.1.17. Suppose D is a λ-term encoding a predicate, i.e. Pcnβ or for every n . Let’s write down a λ-termthat encodes a program that takes a number and computes the next number satisfying the predicate.

First consider

M := λf.λx.(if (Px) then x else f(Sx)),

where S encodes the successor map. Our goal is to have M run on itself. This can be done by using the term F := Y M. Indeed:

Fcnβ(if Pcn then cn else Fcn+1)

for every n .

Notation. λxsz.f will be short hand for λx.λs.λz.f (and the obvious generalisation to any number of variables, labelled in any way).

Lemma 2.1.18. The basic partial recursive functions are λ-definable.

Proof. The i-th projection k is definable by πik : λx1λxk.xi.

Successor is implemented by S := λx.λs.λz.s(xsz).

The zero map is given by Z := λx.c0.

Just compute!

Lemma 2.1.19. The class of λ-definable functions is closed under composition.

Proof. Say G is a λ-term defining g : k , and that λ-terms H1,,Hk define h1,,hk : m . Then the composite map f : n¯g(h1(n¯),,hk(n¯)) is definable by the term

F := λx1xm : (G(H1x1xm)(Hkx1xm))

by inspection.

Lemma 2.1.20. The class of λ-definable functions is closed under primitive recursion.

Proof. Suppose f : m+1 is obtained from h : m+2 and g : m by primitive recursion.

f(0,n¯) := g(n¯) f(k + 1,n¯) := h(f(k,n¯),k,n¯)

and the λ-terms H and G define h and h respectively.

We need a λ-term to keep track of a pair that records the current state of computation: the value of k and the value of f at that stage.

So define

T := λp.[S(pπ1),H(pπ2)(pπ1)x1xn],

which acts on a pair [ck,cf(k,n¯] by updating the iteration data. Then f ought to be definable by

F := λx.λx1xm.xT[c0,Gx1xm]π2.

Indeed,

Fckcn1cnm βckT[c0,Gcn1cnm]π2 βTk[c 0,cg(π)]π2

by definition of ck, and since

T[ck,cf(k,π)] β[Sck,Hcf(k,n¯)ckcn1,,cnm] β[ck+1,ch(f(k,n¯),k,n¯)]

we have

Fckcn1cnmβTk([c 0,Gcn1cnm])π2βcf(k,n¯)

as needed.

Lemma 2.1.21. The λ-definable functions are closed under minimisation.

Proof. Suppose G λ-defines g : m+1 , and that f : m is defined from g by minimisation: f(n¯) = μk.g(k,n¯) = 0.

We can λ-define f by implementing an algorithm that searches for the least k in the following way:

First define a term that can check if a Church numeral is c0, for example

zero? := λx.x(λy.).

You can check that

zero? cnβ { if n = 0 otherwise .

Now we want a term that, on input k, checks if g(k,n¯) = 0 and returns k if so, else runs itself on k + 1. If we can do this, running it on input k = 0 will perform the search.

Let:

Search := λf.λg.λk.λx1 λxm.(if zero? (gkx1 xm) then k else (f(g(Sk)x1 xm))),

and set

F := λx1λxm.(Y Search )Gc0x1 xm.

Note that

(Y Search )Gckcn1 cnmβ Search (Y Search )Gckcn1 cnm,

which is

if zero? (Gckcn1 cnm) then ck else ((Y Search )Gck+1cn1 cnm .

Thus

(Y Search )Gckcn1 cnmβck

if g(k,n¯) = 0 and

(Y Search )Gckcn1 cnmβ(Y Search )Gck+1c1 cm

otherwise, as g is λ-defined by G. Hence

Fcn1cnmβ(Y Search )Gc0cn1 cnmβcf(n¯)

if f is defined on n¯. So F λ-defines f.

Lemma 2.1.22. Every partial recursive function is λ-definable.

Definition 2.1.23 (Godel numbering). Let L be a first-order language. A Gödel numbering is an injection L that is:

  • (1)
    Computable (assuming some notion of computability for strings of symbols over a finite alphabet);
  • (2)
    Its image is a recursive subset of ;
  • (3)
    Its inverse (where defined) is also computable.

Notation. We will use φ to be the Gödel numbering of an element of L, for some fixed choice of Gödel numbering.

One way: assign a unique number ns to each symbol s in your finite alphabet σ. We can then define

s0sk := i=0k(n si + 1).

Remark. We can also encode proofs: add a symbol # to the alphabet and code a proof with lines φ0,,φk as φ0#φ1##φk.

Theorem 2.1.24. Assuming that:

Proof (sketch). Assign Gödel numbers τ to λ-terms τ. We can then consider a partial recursive function in N(t) that on input t checks if t is the Gödel numbering of a λ-term τ, and returns the Gödel numbering of its β-normal form if it exists (undefined otherwise).

We also have partial recursive functions that convert n to cn and vice-versa. Finally, say f is a partial function defined by a λ-term F. We can compute f(m¯) by first converting Church numerals to their Gödel numbers, then append the result to F in order to get Fcn1cnk, then apply N.

If f is defined on n¯, then Fcn1cnk has a β-normal form, and what we get is cf(n¯). Otherwise N(Fcn1cnk) is not defined.

We finish by going back from cf(n¯) to f(n¯).

2.2 Decidability in Logic

Recall that a subset X is recursive (or decidable) if its characteristic map is total recursive.

Definition 2.2.1 (Recursively enumerable). We say that X is recursively enumerable if any of the following are true:

Note, if X and X are both recursively enumerable, then X is recursive. Note that the set of partial recursive function is countable, so we can fix an enumeration {f0,f1,}.

Example 2.2.2. The subset W = {(i,x) : fi is defined on x} 2 is recursively enumerable, but not recursive.

Definition 2.2.3 (Recursive / decidable language). A language L is recursive if there is an algorithm that decides whether a string of symbols is an L-formula.

An L-theory T is recursive if membership in T is decidable (for L-sentences).

An L-theory T is decidable if there is an algorithm for deciding whether Tφ.

We will work with recursive from now on.

Theorem 2.2.4 (Craig). Assuming that:

Then T admits a recursive axiomatisation.

Proof. By hypothesis, there is a total recursive f such that the axioms of T are exactly {f(n) : n }.

Idea: Replace f(n) with something equivalent, but with a shape that lets us retrieve n. Let

ψn = k=1n(f(n))

for each n and

T:= {ψ n : n }.

Then T has the same deductive closure as T. As formulae have finite length, we can check in finite time whether some χ is f(0) or some k=1nAn. By appropriate use of brackets, we can make sure that such an n is “unique” if we are working with some ψn.

In the first case, we halt and say we have a member of T. In the second case, we check if A = f(n), saying we have a member of T if so, and that we don’t otherwise.

We can do this because we can scan the list {f(n) : n < ω} and check symbol by symbol whether f(n) matches A, which takes finite time.

If the input is not of the right shape, we halt and decide that it is T.

Lemma 2.2.5. The set of (Gödel numberings for) total recursive functions is not recursively enumerable.

Proof. Suppose otherwise, so there is a total recursive function whose image is the set of Gödel numberings of total recursive functions.

So for any total recursive r, there is n such that f(n) = r. Define g : by g(n) = f(n)(n) + 1. This is certainly total recursive, but can’t be the function coded by f(m) for any m, contradiction.

Definition 2.2.6 (Language of arithmetic). The language of arithmetic is the first-order language LPA with signature (0,1,+,,<). The base theory of arithmetic is the LPA-theory PA whose axioms express that:

  • (1)
    + and are commutative and associative, with identity elements 0 and 1 respectively;
  • (2)
    distributes over +;
  • (3)
    < is a linear ordering compatible with + and ;
  • (4)
    x.y.(x < y z.x + z = y);
  • (5)
    0 < 1 x.(x > 0 x 1);
  • (6)
    x.x 0.

The (first-order) theory of Peano arithmetic PA is obtained from PA by adding the scheme of induction: for each LPA-formula φ(x,y¯), the axiom

Iφ := y¯.(φ(0,y¯) x.(φ(x,y¯) φ(x + 1,y¯)) x.φ(x,y¯)).

Definition 2.2.7 (Delta0-formula, Sigma1-formula). A Δ0-formula of PA is one whose quantifiers are bounded, i.e. x < t.φ(x) or x < t.φ(x), where t is not free in φ and φ is quantifier free.

We say φ(x¯) is a Σ1-formula if there is a Δ0-formula ψ(x¯,y¯) such that

PA φ(x¯) y¯.ψ(x¯,y¯).

It is a Π1-formula if there is a Δ0-formula ψ(x¯,y¯) such that

PA φ(x¯)y¯.ψ(x¯,y¯).

In Example Sheet 4, you will prove that the characteristic function of a Δ0-definable set is partial recursive. We will show that the Σ1-definable sets are precisely the recursively enumerable ones.

Recall that defining x,y = (x+y)(x+y+1) 2 + y yields a total recursive bijection 2 .

Applying this a bunch of times, we get total recursive bijections k by v,w¯ = v,w¯.

This is not good, as we have a different function for each k. We’d like a “pairing function” that lets us see a number as a code for a sequence of any length.

This can be done within any model of PA by using a single function β(x,y) (known as Gödel’s β-function) which is definable in PA.

We want an arithmetic procedure that can associate a code to sequences of any length, and such that the entries of the sequence can be recovered from the code.

We will do this by a clever application of the Chinese Remainder Theorem.

Suppose given a sequence x0,x1,,xn1 of natural numbers. We want numbers m + 1,2m + 1,,nm + 1 to serve as moduli, with xi < (i + 1)m + 1, and all of which are pairwise coprime. If we can find m such that these conditions hold, then there is a number a such that a xi(mod(i + 1)m + 1).

Taking m = max (n,x0, ,xm1)! works.

We say that the pair (a,m) codes the sequence.

Definition 2.2.8 (beta indexing). The function β : 2 is defined by β(x,i) = a%(m(i + 1) + 1), where a and m are the unique numbers such that x = a,m.

Remark. The forumula β(x,y) = z is given in PA by a Δ0-formula. We will use the notation (x)i for β(x,i); thus the decoding property is that (x)i = xi if x = a,m codes x0,,xn1.

Lemma 2.2.9 (Godel’s Lemma). Assuming that:

  • MPA

  • n

  • x0,,xn1 M

Then there is u M such that M(u)i = xi for all i < n.

Theorem 2.2.10. Assuming that:

  • f : k a partial function

Then f is recursive if and only if there is a Σ1-formula 𝜃(x¯,y) such that y = f(x¯)𝜃(x¯,y).

Proof.

Corollary 2.2.11. A subset A k is recursively enumerable if and only if there is a Σ1-formula ψ(x1,,xk) such that, given x¯ k, we have x¯ A if and only if ψ(x).

Proof.

Any model of PA includes a copy of inside of it: consider the standard natural numbers

n̲ = SSSS n0.

In fact, embeds in any model PA as an initial segment: essentially because

PA x.(x k̲ x = 0̲ x = 1̲ x = k̲).

In Example Sheet 4, you will see that is a Δ0-elementary substructure of any model of PA: every Δ0-sentence φ(n̲) true in is also true in the model.

Definition 2.2.12 (Representation of a total function). Let f : k be total and T be any LPA -theory extending PA. We say that f is represented in T if there is an LPA formula 𝜃(x1,,xk,y) such that, for all n¯ k:

  • (a)
    T !y.𝜃(n¯,y)
  • (b)
    If k = f(n¯), then T 𝜃(n¯,k̲)

Lemma 2.2.13. Every total recursive function f : k is Σ1-represented in PA.

Proof. The graph of f is given by a Σ1-formula by Theorem 2.2.10, say z¯.φ(x¯,y,z¯) where φ Δ0. Without loss of generality, we may assume that z¯ is a single variable (for example, rewrite z.w¯ < z.φ(x¯,y,w¯)).

Let ψ(x¯,y,z) be the Δ0-formula

φ(x¯,y,z) u,v y + z.(u + v < y + z ¬φ(x¯,u,v)).

Then the Σ1-formula 𝜃(x¯,y) := z.ψ(x¯,y,z) represents f in PA.

We show PA 𝜃(n¯,k) first, where k = f(n¯). Note that k is the unique element of such that z.φ(n¯,k,z), as f is a function.

Take l to be the first natural number such that φ(n¯,k,l). Then ψ(n¯,k,l) too, whence z.ψ(n¯,k,z). But any Σ1-sentence true in is true in any model of PA(c.f. Example Sheet 4), so PAz.ψ(n¯,k,z), i.e. PA 𝜃(n¯,k).

To see that PA!y.𝜃(n¯,y), let l be the first number such that φ(n¯,k,l), where k = f(n¯). Suppose a,b MPA, with Mψ(n¯,a,b). We will show that a = k. Completeness settles the claim. Again, φ(n¯,k,l) is a Δ0-sentence true in , thus true in M.

Using the fact that < is a linear ordering in M, we have a,b k + l , so a,b (as is an initial segment of M). Now Mψ(n¯,a,b) Δ0, hence ψ(x¯,a,b) and thus z.φ(n¯,a,z). Thus a = k as needed.

Corollary 2.2.14. Every recursive set A k is Σ1-representable in PA.

Proof. The characteristic function χA of A is total recursive, so χA(x¯) = y is represented by some Σ1-formula 𝜃(x¯,y) in PA. But then 𝜃(x¯,1) represents A in PA.

Lemma 2.2.15 (Diagonalisation Lemma). Assuming that:

  • T an LPA -theory

  • in T, every total recursive function is Σ1-represented

  • 𝜃(x) an LPA -formula with one free variable x

Then there is an LPA -sentence G such that
T G 𝜃(G).

Moreover, if 𝜃 is a Π1-formula, then we can take G to be a Π1-sentence.

Proof. Define a total recursive function diag this way: on input n , check if n = σ(x) is the Gödel numbering of some LPA -formula σ(x). If so, return y.(y = n̲ σ(y)), else return 0.

As diag is total recursive, it is Σ1-represented in T by some δ(x,y). Consider the formula

ψ(x) := z.(δ(x,z) 𝜃(z)).

Let n = ψ(x) and G := y.(y = n̲ ψ(y)). This makes G the sentence whose Gödel numbering is diag (ψ(x)). It is obvious that T G ψ(n̲), so we know that

T G z.(δ(n̲,z) 𝜃(z)). (α)

Now δ(x,y) represents diag in T, and diag (n) = G by construction, hence

T z.(δ(n̲,z) z = G). (β)

Combining (α) and (β), we get T G 𝜃(G) as needed.

Finally, note that if 𝜃 Π1, then both ψ and G are equal to a Π1-formula.

Theorem 2.2.16 (Crude Incompleteness). Assuming that:

  • T be a recursive set of (Gödel numberings of) LPA -sentences

  • T is consistent (never includes both φ and ¬φ)

  • T contains all the Σ1 and Π1 sentences provable in PA

Then there is a Π1-sentence τ such that τT and ¬τT.

Proof. Let 𝜃(x) be a Σ1-formula that represents T in PA, so that

x TPA 𝜃(x)andxTPA¬𝜃(x).

This exists since T is recursive. By the Diagonalisation Lemma, there is a Π1-sentence τ such that PA τ ¬𝜃(τ ).

If τ T, then PA 𝜃(τ ), and thus PA¬τ. But then ¬τ T (as ¬τ Σ1 and PA proves it).

If ¬τ T, then τT, so PA¬𝜃(τ ), and thus PA τ. As τ Π1 and PA τ, we have τ T.

Since T is consistent, we can’t have either of τ or ¬τ in T.

Corollary 2.2.17 (Godel-Rosser Theorem). Let T be a consistent LPA -theory extending PA and admitting a recursively enumerable axiomatisation. Then T is Π1-incomplete: there is a Π1-sentence τ such that T τ and T ¬τ.

Proof. By Craig’s Theorem, we may assume that T is recursive. Suppose that T is Π1-complete, and consider the set S of (Gödel numberings of) all the Σ1 and Π1 sentences in LPA that T proves.

The set S is recursive: we can effectively decide if a given sentence is Σ1 or Π1, then check if σ S by systematically searching through all proofs using the axioms in T, until we either find a proof of σ or a proof of ¬σ. Since T is Π1-complete, there is always such a proof, and we’ll find it in finite time.

But then S satisfies the hypotheses of Theorem 2.2.16, so there is a Π1-sentence τ with τ S and ¬τ S, contradicting Π1-completeness of T.

Definition 2.2.18 (Recursive structure). A (countable) LPA -structure M is recursive if there are total recursive functions : 2 , : 2 , a binary recursive relation 2, and natural numbers n0,n1 such that M(,,,,n0,n1) as LPA -structures.

We will show that the usual is the only recursive model of PA (up to ).

Strategy:

Note that there is a Σ1-formula pr (x,y) that captures y being the x-th prime, and PA x.!y.pr (x,y). So if thinks that k is the n-th prime, then any model of PA thinks so too. Write πn for the n-th prime.

Lemma 2.2.19 (Overspill). Assuming that:

  • M a non-standard model of PA

  • φ(x) an LPA -formula

  • Mφ(n) for all standard natural numbers n

Then there is a nonstandard natural number e such that Mφ(e).

Proof. Say Mφ(n) for all standard n, but only them. Then Mφ(0) and Mn.(φ(n) φ(n + 1)) holds (if φ(n) holds, then n and hence n + 1 are standard).

By Iφ (induction), we conclude that Mn.φ(n). But M is non-standard, so there is non-standard e M with φ(e), contradiction.

Fix some m , and a property φ(x) of the natural numbers.

Definition 2.2.20 (Canonically coded). A subset S is canonically coded in a model M of PA if there is c M such that

S = {n : y.(πn̲ × y = c)}

where n̲ denotes the standard number n in the model.

We could use other formulas to code subsets. Th subsets of coded in M are those S for which there is a PA -formula φ(x,y) and c M such that S = {n : Mφ(n̲,c)}.

As it turns out, coding via Σ1-formulae gives nothing new:

Proposition 2.2.21. Assuming that:

  • C(u,x) be a Δ0-formula

  • M a non-standard model of PA

Then given any b~ M, there is c M such that, for any n :
M k < b~.C(k,n) y.(πn̲ × y) = c.

Proof (sketch*). The following formula holds in for any n:

b.a.u < n.(k < b.C(k,u) y.(πu × y) = a).

This is by the reasoning we gave when introducing codes, which works due to the bound on k and u. This can be proved in PA *.

Thus

M b.a.u < n̲.(k < b.C(k,u) y.(πu × y = a))

for any n . So by Lemma 2.2.19 there is a non-standard w M such that

M b.a.u < w.(k < b.C(k,u) y.(πu × y = a)).

So for any b~ M, there must be c M such that

M u < w.(k < b~.C(k,u) y.(πu × y = c)).

Now w is non-standard, so Mn̲ < w for all n . So for any b~ M there is c M with

M k < b~.C(k,n) y.(πn̲ × y = c)

for all n .

Definition 2.2.22 (Recursively inseparable). We say that subsets A,B are recursively inseparable if they are disjoint and there is no recursive C with B C = and A C.

Proposition 2.2.23. There are recursively enumerable subsets A,B that are recursively inseparable.

Proof. Fix an effective enumeration {φn : n < ω} of the partial recursive functions. Define A = {n : φn(n) = 0} and B = {n : φn(n) = 1}, which are clearly disjoint and are clearly recursively enumerable.

Suppose there is a recursive C with A C and B C = , and write χC for its (total recursive) characteristic function. There must be u such that χC = φu, as χC is total recursive.

Since χC(u) and is either 0 or 1, we have either u A or u B.

If u A, then χC(u) = φu(u) = 0, so uC, contradicting A C; so u B. But then χC(u) = φu(u) = 1, so u C, contradicting B C = . Thus A and B are recursively inseparable.

Lemma 2.2.24. Assuming that:

  • MPA non-standard

Then there is a non-recursive set S which is canonically coded in M.

Proof. Say A,B are recursively enumerable and recursively inseparable. By Corollary 2.2.11, there are Σ1-formulae u.a(u,x) and u.b(u,x) defining A and B respectively (so a and b are Δ0-formulae).

Fix n . As the sets are disjoint, we have:

v < n.w < n.x < n.¬(a(v,x) b(w,x)).

As this sentence is Δ0, it follows, for any non-standard MPA and n̲ M that:

M v < n̲.w < n̲.x < n̲.¬(a(v,x) b(w,x)).

By Overspill, there is some non-standard c M such that

M v < c.w < c.x < x.¬(a(v,x) b(w,x)). (∗)

Now define X := {n : v < c.a(v,n̲)}. Note that:

As A and B are recursively inseparable, X can’t be recursive. This shows that M must encode a non-recursive set, which implies that it must canonically encode a non-recursive set by Proposition 2.2.21.

Theorem 2.2.25 (Tennenbaum). Assuming that:

  • M = (M,,,,n0,n1) a countable non-standard model of PA

Then is not recursive.

Proof. As M is countable, we may as well assume that M = , n0 = 0, n1 = 1.

By Lemma 2.2.24, there is some c M that canonically codes a non-recursive subset X = {n : My.(πn̲ × y = c)} .

As PA proves that

πn̲ × x = x + + xπn times,

we have that

πn̲ × y = y + + y πn times

for all y M. So n X if and only if there is d M such that

c = d dπn times.

Suppose is recursive. Then we can can through (which is M) and look for some d M that realises the disjunction of:

{ c = x xπn x’s c = x xπn x’s 1 c = x xπn x’s 1 1πn 1 ones

As is recursive, we can decide whether the disjunction holds of a given d. Moreover, the search for such d always terminates:

Combining these, we get that division of c by πn̲ in M leaves a unique quotient d M, and remainder r πn̲, which is either 0 or 1 or 1 1 or …or 1 1 1 (πn 1 times); i.e. one of the disjunctions from before.

Now we see that X is recursive: if our search provides d such that

M c = d dπn times,

then n X, and if the search gives d satisfying one of the other disjunctions, then nX.

This contradicts the choice of X, so can’t be recursive.

˙

Index

Gödel numbering

PA

α-equivalent

Boolean algebra

β-contraction

bounded

β-normal form

β-redex

β-reduction

base theory of arithmetic

canonically coded

Church numeral

complemented

composition

context

decide

decidable

decidable

distributive

filter

force

forcing

fixed-point combinator

Heyting algebra

height

Heyting homomorphism

H-valid

H-valuation

IPC

Kripke model

λ-abstraction

λ-application

lattice

λ-definable

λ-define

lpa

Lindenbaum-Tarski algebra

λ-term

minimisation

persistence

partial recursive

partial recursive function

prime

primitive recursion

primitive recursive

principal

projection

proper

principal up-set

recursive

recursive

recursive

reduces

redex

reduction

recursively enumerable

represent

represented

representable

representation

recursively inseparable

state

simply typed λ-term

successor

term

total recursive

typability relation

terminal segment

Takahashi translation

type

λ-term

term

valuation

world

zero