SLIDE 1 An applications of computability theory: arithmetic and G¨
Introduction to Computability Class 12
SLIDE 2 The problem of foundations: some background
◮ In the beginning of the 20th century, there was much turmoil
concerning the foundations of mathematics.
◮ Geometry and calculus were reduced to the newborn theory of sets. ◮ But what are sets? How can we know which sets exist? ◮ Mathematicians disagreed about these questions and about
what set-theoretic principles were acceptable in a proof.
◮ Worse, contradictions were discovered in early versions of set theory. ◮ Example: Russell’s paradox. Let R = {x | x ∈ x}.
R ∈ R ⇐ ⇒ R ∈ R
◮ Mathematics is supposed to be the realm of certainty.
But now it appeared to rest on shaky and unclear foundations.
SLIDE 3 Hilbert’s solution
◮ Mathematics is not concerned with what objects are, but only with
what properties they have. One must be able to say at all times—instead of points, straight lines, and planes—tables, chairs, and beer mugs.
◮ Mathematics proceeds by postulating some statements (axioms),
and deriving other statements (theorems).
◮ We never manipulate infinite objects (sets, real numbers, etc.) but
- nly statements about these objects, which are finite entities.
◮ It is at this higher level that certainty can be recovered.
SLIDE 4 Mathematical certainty recovered
◮ we can formalize mathematical statements without ambiguity; ◮ we can also lay out precise, verifiable rules for making inferences; ◮ setting the axioms of a theory is a matter of definition; ◮ so, there is no room for disagreement over whether something
counts as a theorem or not.
SLIDE 5
The completeness question Can we make our axiomatization just rich enough to capture all the properties of the structure that it is supposed to characterize? We can consider this question in many settings, the most basic being arithmetic, the theory of natural numbers. We are going to explore the above question for arithmetic; first, we need to see how arithmetic can be regimented in a formal language.
SLIDE 6 The language of arithmetic Terms
◮ A term is an expression formed by means of 0, variables x, y, z . . . , a
unary function symbol S, and binary function symbols + and · .
◮ Notation: n := S(. . . S(0)) where S occurs n times. ◮ Examples:
3, 2 + 1, x · y, 5 + (3 · z) Atomic formulas
◮ An atomic formula is an expression t = t′, where t and t′ are terms. ◮ Examples:
1 = 2, 1 · x = 5, x + y = y + x
SLIDE 7 Formulas A formula is an expression built up from atomic formulas by means of connectives (¬, ∧, ∨, →) and quantifiers (∀x, ∃x, for x a variable). Examples
◮ ¬(x = 0) ◮ ∀x(x = 0 → ¬(x = 1)) ◮ ∀x∃y(x · y = 1)
Notation We write t = t′ for ¬(t = t′) Sentences A sentence is a formula that contains no free variables.
SLIDE 8 ◮ We say that a sentence ψ is true in N (notation: N |
= ψ) if it is true when:
◮ 0 is interpreted as the number zero ◮ S, +, · are interpreted as successor, sum, and product on N ◮ quantifiers are interpreted as ranging over N
◮ Examples:
◮ N |
= ∃x(x + x = 0)
◮ N |
= ∃x(S(x) = 0)
SLIDE 9 Looking for truth
◮ Our goal is to find out which sentences are true in N. ◮ How can we do this? ◮ Axiomatic method: identify some sentences that are clearly true,
take them as axioms, and use logic to infer consequences.
◮ If A is a set of sentences, let us write A ⊢ ψ if ψ can be inferred
from the sentences in A by first-order logic. Complete axiomatizations? We would like to identify a set of sentences A that satisfies:
◮ soundness: A ⊢ ψ ⇒ N |
= ψ
◮ completeness: N |
= ψ ⇒ A ⊢ ψ
SLIDE 10 The main candidate: Peano Arithmetic The axioms of Peano Arithmetic (PA) are the following sentences.
◮ Zero is not a successor:
∀x(0 = Sx)
◮ Successor is injective:
∀x∀y((x = y) → (Sx = Sy))
◮ Recursive definition of sum:
∀x(x + 0 = x) ∀x(x + Sy = S(x + y))
◮ Recursive definition of product:
∀x(x · 0 = 0) ∀x(x · Sy = (x · y) + x)
◮ Induction scheme. For any formula ψ(x, y), we have the axiom:
∀x(ψ(x, 0) ∧ ∀y(ψ(x, y) → ψ(x, Sy)) → ∀yψ(x, y))
SLIDE 11
PA is quite powerful If we try to build up arithmetic by making logical deductions in PA, we find that theorem after theorem, all the traditional results can be derived. Question: is PA complete? Can all true sentences be deduced by logic from the axioms of PA? If not, what axioms need to be added to obtain a complete system?
SLIDE 12 We will see that PA is not complete. Worse, it cannot be completed! To see why, let us go back to our main question above. The axiomatization question Is it possible to identify a set of sentences A that satisfies:
◮ soundness: A ⊢ ψ ⇒ N |
= ψ
◮ completeness: N |
= ψ ⇒ A ⊢ ψ
SLIDE 13 A trivial answer Sure! Just take A = {ψ | N | = ψ}
◮ This is pointless: we don’t know what the true sentences are.
The whole point of an axiomatization is finding out.
◮ We want to know what the axioms of our system are. ◮ I.e., we should be able to tell whether or not a sentence is an axiom. ◮ The predicate “being an axiom” must be decidable. ◮ But what does this mean, exactly?
SLIDE 14 Coding formulas Similarly to what we did for programs, we can define a coding of formulas as natural numbers:
◮ given a formula ψ, we can compute its code ψ ◮ given a number n, we can compute the formula ψn that it encodes
The idea of coding formulas as numbers is due to G¨
For this reason, ψ is also called the G¨
SLIDE 15 Coding predicates With a predicate P of formulas we associate a predicate MP of numbers such that: MP(ψ) ⇐ ⇒ P(ψ) Computability on formulas We can then transfer notions of computability theory to formulas:
◮ we say that predicate P(ψ) is decidable if MP(x) is decidable ◮ we say that predicate P(ψ) is p.d. if the predicate MP(x) is p.d. ◮ we call a set of formulas F recursive if “ψ ∈ F” is decidable ◮ we call a set of formulas F r.e. if “ψ ∈ F” is p.d.
SLIDE 16 Now we can formulate the relevant constraint on axiomatization. The axiomatization question, revisited Is it possible to identify a recursive set of sentences A that satisfies:
◮ soundness: A ⊢ ψ ⇒ N |
= ψ
◮ completeness: N |
= ψ ⇒ A ⊢ ψ
SLIDE 17 We can also ask other crucial questions about arithmetic truth. How computable is arithmetic truth? Consider the predicate: True(ψ) = “N | = ψ”
◮ is True decidable?
Is there a procedure to tell if a statement of arithmetic is true?
◮ is True partially decidable?
Is there a procedure to enumerate all true statements of arithmetic? These are the questions that we will address first.
SLIDE 18
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y
SLIDE 19
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y ∃z(x + z = y)
SLIDE 20
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y ∃z(x + z = y) even(x)
SLIDE 21
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y ∃z(x + z = y) even(x) ∃y(x = 2 · y)
SLIDE 22
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y ∃z(x + z = y) even(x) ∃y(x = 2 · y) prime(x)
SLIDE 23
Definition A predicate M(x1,. . ., xn) of numbers is defined by formula χM(x1,. . ., xn) if for all numbers n1, . . . , nk: M(n1, . . . , nk) holds ⇐ ⇒ N | = χM(n1, . . . , nk) We say that M is definable if it is defined by some formula. Predicate Formula x ≤ y ∃z(x + z = y) even(x) ∃y(x = 2 · y) prime(x) ¬∃y∃z((y = 1) ∧ (z = 1) ∧ (x = y · z))
SLIDE 24
Definition We say that a function f : Nk →N is defined by a formula χf (x1,. . ., xk, y) in case it defines the predicate “f (x1, . . . , xk) = y”, that is, if: N | = χf (n1, . . . , nk, m) ⇐ ⇒ f (n1, . . . , nk) = m Predicate Formula Successor S(x)
SLIDE 25
Definition We say that a function f : Nk →N is defined by a formula χf (x1,. . ., xk, y) in case it defines the predicate “f (x1, . . . , xk) = y”, that is, if: N | = χf (n1, . . . , nk, m) ⇐ ⇒ f (n1, . . . , nk) = m Predicate Formula Successor S(x) y = S(x)
SLIDE 26
Definition We say that a function f : Nk →N is defined by a formula χf (x1,. . ., xk, y) in case it defines the predicate “f (x1, . . . , xk) = y”, that is, if: N | = χf (n1, . . . , nk, m) ⇐ ⇒ f (n1, . . . , nk) = m Predicate Formula Successor S(x) y = S(x) Zero Z(x)
SLIDE 27
Definition We say that a function f : Nk →N is defined by a formula χf (x1,. . ., xk, y) in case it defines the predicate “f (x1, . . . , xk) = y”, that is, if: N | = χf (n1, . . . , nk, m) ⇐ ⇒ f (n1, . . . , nk) = m Predicate Formula Successor S(x) y = S(x) Zero Z(x) y = 0
SLIDE 28 Definition We say that a function f : Nk →N is defined by a formula χf (x1,. . ., xk, y) in case it defines the predicate “f (x1, . . . , xk) = y”, that is, if: N | = χf (n1, . . . , nk, m) ⇐ ⇒ f (n1, . . . , nk) = m Predicate Formula Successor S(x) y = S(x) Zero Z(x) y = 0 Projection Un
i (x1, . . . , xn)
y = xi
SLIDE 29 Theorem All computable functions are definable. Proof idea
◮ any computable function is obtained from basic recursive functions
by composition, recursion, and minimalization
◮ we proceed by induction on the construction of f ◮ we have seen that the basic recursive functions are definable ◮ we are left with the induction step:
◮ if f is obtained by composition from defin. functions, it is definable ◮ if f is obtained by recursion from definable functions, it is definable ◮ if f is obtained by minimization from defin. functions, it is definable
SLIDE 30 Illustration: the case of composition If f = g ◦ h1, . . . , hn and g, h1, . . . , hn are definable, then f is definable. Suppose we have the following definitions:
◮ g(x) defined by χg(x, y) ◮ hi(x) defined by χhi(x, y)
Then, f (x) is defined by the following formula χf (x, y): ∃z1 . . . ∃zn(χh1(x, z1) ∧ · · · ∧ χhn(x, zn) ∧ χg(z1, . . . , zn, y))
SLIDE 31 Corollary All partially decidable predicates are definable. Proof
◮ For simplicity, consider the unary predicate M(x). ◮ If M is p.d., the semi-characteristic function sM is computable. ◮ So by the previous theorem we have a formula χsM(x, y) such that
sM(n) = m ⇐ ⇒ N | = χsM(n, m)
◮ This means that we have
M(n) holds ⇐ ⇒ sM(n) = 1 ⇐ ⇒ N | = χsM(n, 1)
◮ Therefore, M(x) is defined by the formula χM(x) := χsM(x, 1).
SLIDE 32 Theorem (arithmetic truth is not p.d.) The predicate True is not partially decidable. Proof
◮ By reduction: we will show that ¬K ≤ MTrue ◮ We know that the predicate K(x) = “ϕx(x)↓ ” is p.d. ◮ Therefore there is a formula χK(x) that defines K(x) ◮ This means that ϕn(n)↓ ⇐
⇒ N | = χK(n)
◮ So, we have:
¬K(n) ⇐ ⇒ N | = χK(n) ⇐ ⇒ N | = ¬χK(n) ⇐ ⇒ True(¬χK(n)) ⇐ ⇒ MTrue(¬χK(n))
SLIDE 33 Proof, continued
◮ We have established: ¬K(n)
⇐ ⇒ MTrue(¬χK(n))
◮ Now, define a function k : N → N by letting k(n) := ¬χK(n) ◮ k is total, and it is computable by the following procedure. Given n,
◮ write down the sentence ¬χK(n) ◮ compute the corresponding code ¬χK(n)
◮ We have that: ¬K(n) ⇐
⇒ MTrue(k(n))
◮ So, ¬K ≤ MTrue. Since ¬K is not p.d., neither is MTrue ◮ By definition, this means that the predicate True is not p.d.
SLIDE 34
This means that the set of true arithmetic statements is not r.e. By the characterization of r.e. sets as the ranges of total computable functions, we have: Corollary There exists no procedure to enumerate all true statements of arithmetic. Moreover, since TrueN is not p.d., it is not decidable either. So, we have: Corollary There exists no procedure to determine if a sentence of arithmetic is true. These results set inherent limits to our knowledge of arithmetic truth.
SLIDE 35 Back to axiomatization
◮ Let us now come back to the issue of axiomatization. ◮ To tackle it, we need to refresh notions about proofs in FOL. ◮ Many different proof systems for classical first-order logic exist. ◮ The simplest to state (though not to work with) is the Hilbert-style
proof system.
◮ This system has many logical axioms and only two inference rules.
Inference rules Modus Ponens Generalization ψ ψ → χ χ ψ ∀xψ
SLIDE 36 Axioms for propositional connectives
◮ Implication:
◮ ψ → (χ → ψ) ◮ (ψ → (χ → ρ)) → ((ψ → χ) → (ψ → ρ))
◮ Conjunction:
◮ (ψ ∧ χ) → ψ ◮ (ψ ∧ χ) → χ ◮ ψ → (χ → (ψ ∧ χ))
◮ Disjunction:
◮ ψ → (ψ ∨ χ) ◮ χ → (ψ ∨ χ) ◮ (ψ → ρ) → ((χ → ρ) → (ψ ∨ χ → ρ))
◮ Negation:
◮ (ψ → ρ) → ((ψ → ¬ρ) → ¬ψ) ◮ ¬ψ → (ψ → χ) ◮ ¬¬ψ → ψ
SLIDE 37 Axioms for quantifiers
◮ Universal quantifier:
◮ ∀xψ(x) → ψ(t) ◮ ∀x(χ → ψ(x)) → (χ → ∀xψ(x))
where x does not occur in χ
◮ Existential quantifier:
◮ ψ(t) → ∃xψ(x) ◮ ∃x(ψ(x) → χ) → (∃xψ(x) → χ)
where x does not occur in χ
SLIDE 38 Axioms for quantifiers
◮ Universal quantifier:
◮ ∀xψ(x) → ψ(t) ◮ ∀x(χ → ψ(x)) → (χ → ∀xψ(x))
where x does not occur in χ
◮ Existential quantifier:
◮ ψ(t) → ∃xψ(x) ◮ ∃x(ψ(x) → χ) → (∃xψ(x) → χ)
where x does not occur in χ
Proposition The predicate LogAx(ϕ) = “ϕ is a logical axiom” is decidable.
SLIDE 39 Definition (Logical proofs) Let A be a set of formulas and ψ a formula. A Hilbert-style proof of ψ from A is a sequence π = χ1 . . . χn of formulas, such that:
◮ χn = ψ ◮ for every i ≤ n, either of the following holds:
◮ χi is a logical axiom ◮ χi ∈ A ◮ χi is obtained by modus ponens from χj, χk with j, k < i ◮ χi is obtained by generalization from χj with j < i
We write A ⊢ ψ to mean that a proof of ψ from A exists.
SLIDE 40 Coding proofs as numbers
◮ Using our coding for formulas we can define a coding for proofs. ◮ If π = χ1 . . . χn, then we let:
cP(π) = c∗χ1, . . . , χn where c∗ was our map for coding sequences of arbitrary length.
SLIDE 41 Proposition Consider the predicate: ProofA(x, y) = “x codes a proof of ψy from A” If A is recursive, then ProofA(x, y) is decidable.
- Proof. To decide the predicate, proceed as follows:
◮ decode y as a formula ψy ◮ decode x as a sequence π = ξ1 . . . ξk of formulas ◮ check whether ξk = ψy ◮ for i ≤ k, check if at least one of the following conditions hold:
◮ ξi is a logical axiom ◮ ξi ∈ A ◮ χi is obtained by modus ponens from χj, χk with j, k < i ◮ χi is obtained by generalization from χj with j < i
◮ if all these checks succeed, output 1; otherwise, output 0
SLIDE 42 Definition ThmA(ψ) = “A ⊢ ψ” Proposition If A is recursive, ThmA is partially decidable. Proof.
◮ MThmA(x) = ∃yProofA(y, x) ◮ Since ProofA is decidable, MThmA is p.d., and so is ThmA
SLIDE 43 Theorem (a version of G¨
No recursive set of axioms is sound and complete for arithmetic. That is, there is no recursive set A such that A ⊢ ψ ⇐ ⇒ N | = ψ. Proof
◮ For a contradiction, suppose that such an A exists. ◮ This means that we have ThmA(ψ) ⇐
⇒ True(ψ).
◮ But this is impossible. ◮ Since A is recursive, we know that ThmA is p.d. ◮ But we have proved above that True is not p.d.
SLIDE 44 Corollary (Every axiomatization of arithmetic is incomplete) Let A be a set of axioms which is recursive and sound. Then there exists a sentence ψ such that A ⊢ ψ and A ⊢ ¬ψ. Proof
◮ Let A be recursive and sound. ◮ By the previous theorem, A is not complete. ◮ This means that for some ψ, N |
= ψ but A ⊢ ψ.
◮ A ⊢ ¬ψ, since N |
= ¬ψ and A is sound.
◮ Thus, A ⊢ ψ and A ⊢ ¬ψ.
SLIDE 45 ◮ As this proof shows, incompleteness is not an accidental feature of a
specific formal system, e.g., PA.
◮ Rather, it is an inherent limitation to the axiomatic method, which
stems from the fact that the set of arithmetic truths is not r.e.
◮ The impossibility of a complete axiomatization of arithmetic is a
consequence of the limitations we saw in computability theory.
SLIDE 46
For a brighter view of axiomatic theories of arithmetic, let us now see some results about what can be done in PA. Definition We say that a function f : Nk → N is represented by a formula χf (x, y) in PA in case whenever f (n1, . . . , nk) = m we have: PA ⊢ χf (n1, . . . , nk, m) ∧ ∀x(χf (n1, . . . , nk, x) → x = m) Example Addition is represented by the formula x1 + x2 = y in PA, that is: n1 + n2 = m ⇒ PA ⊢ n1 + n2 = m This is true because PA includes the recursive definition of addition.
SLIDE 47 Theorem Every computable function f is representable in PA.
- Proof. By induction on the definition of f as a recursive functions.
(The details are quite complicated.) This is a powerful result:
◮ We saw above that the language of PA has the resources to define
all computable functions;
◮ now we know that the axioms of PA provide the resources to
compute the values of these functions, whenever they are defined.
◮ In other words, all computable functions can be computed inside PA.
SLIDE 48 Definition We say that a predicate M(x1, . . . , xk) of numbers is represented by a formula χM(x1, . . . , xk) in PA if for all numbers n1, . . . , nk:
◮ M(n1, . . . , nk) does hold
⇒ PA ⊢ χM(n1, . . . , nk)
◮ M(n1, . . . , nk) doesn’t hold ⇒
PA ⊢ ¬χM(n1, . . . , nk) Intuitively, M is representable in PA if PA decides M. Definition We say that a predicate M(x1, . . . , xk) of numbers is semi-represented by a formula χM(x1, . . . , xk) in PA if for all numbers n1, . . . , nk:
◮ M(n1, . . . , nk) does hold
⇒ PA ⊢ χM(n1, . . . , nk)
◮ M(n1, . . . , nk) doesn’t hold ⇒
PA ⊢ χM(n1, . . . , nk) Intuitively, M is representable in PA if PA semi-decides M.
SLIDE 49 Theorem All decidable predicates are representable in PA. Proof
◮ For simplicity, suppose M(x) is unary. ◮ If M is decidable, then cM is computable. ◮ So, we have a formula χcM(x, y) which represents cM. ◮ We claim that the formula χcM(x, 1) represents M. ◮ If M(n) holds, cM(n) = 1; since χcM represents cM, PA ⊢ χcM(n, 1) ◮ If M(n) doesn’t hold, cM(n) = 0. We reason as follows:
◮ since χcM represents cM, PA ⊢ χcM (n, 0) ∧ ∀x(χcM (n, x) → x = 0) ◮ by the rules of logic, this implies PA ⊢ χcM (n, 1) → (1 = 0) ◮ since PA ⊢ 1 = 0, it follows PA ⊢ ¬χcM (n, 1)
◮ Thus, M is representable in PA.
SLIDE 50 Theorem All partially decidable predicates are semi-representable in PA. Proof Similar to the one of the previous theorem. Again, these results tell us that PA is quite powerful, having the tools to:
◮ decide every decidable predicate ◮ semi-decide every partially decidable predicate.
SLIDE 51 Theorem The predicate ThmPA(ψ) = “PA ⊢ ψ” is undecidable. Proof
◮ By reduction: we show that K ≤ MThmPA(x). ◮ Since K(x) is p.d., we have χK(x) which semi-represents K in PA. ◮ Let h : N → N be the function h(n) = χK(n). ◮ h is total and computable (same argument as above) ◮ Claim: K(n) ⇐
⇒ MThmPA(h(n))
◮ If K(n) holds, then by semi-representability PA ⊢ χK(n);
so we have MThmPA(χK(n)), i.e., MThmPA(h(n)).
◮ If K(n) doesn’t hold, then by semi-representability PA ⊢ χK(n);
so MThmPA(χK(n)) does not hold, i.e., MThmPA(h(n)) does not hold.
◮ Hence, K ≤ MThmPA. Since K is undecidable, so is MThmPA.
SLIDE 52 A summary of the situation What we can do in PA, and in any recursive extension of PA
◮ decide whether something counts as a proof ◮ systematically enumerate all the theorems ◮ compute any computable function ◮ decide any decidable predicate ◮ semi-decide any partially decidable predicate
What we cannot do in PA, or in any recursive extension of PA
◮ deduce all true statements of arithmetic ◮ decide all statements of arithmetic ◮ decide whether a statement is a theorem
SLIDE 53 Some concluding remarks On the axiomatic method
◮ The axiomatic method is still our best tool to achieve clarity and
certainty in mathematics.
◮ But the incompleteness results force us to work with systems which
are always partial—which always leave some issues undecided.
◮ Of course, these issues will be decided by stronger systems.
But how to choose between these systems? On the role of computability
◮ The notions of computability theory are central not just to computer
science and AI, but also to logic and the foundations of mathematics.
◮ By applying techniques from computability theory, such as reduction
- r the diagonal method, some deep results can be readily obtained.