Predicate Logic - Undecidability

Similar documents
Predicate Calculus - Undecidability of predicate calculus Moonzoo Kim CS Dept. KAIST

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936

Informal Statement Calculus

Tape encoding of lists of numbers

Decidability: Church-Turing Thesis

Introduction to Turing Machines

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

PROOFS IN PREDICATE LOGIC AND COMPLETENESS; WHAT DECIDABILITY MEANS HUTH AND RYAN 2.3, SUPPLEMENTARY NOTES 2

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

CS156: The Calculus of Computation

There are problems that cannot be solved by computer programs (i.e. algorithms) even assuming unlimited time and space.

Large Numbers, Busy Beavers, Noncomputability and Incompleteness

CS20a: Turing Machines (Oct 29, 2002)

Provably Total Functions of Arithmetic with Basic Terms

CS156: The Calculus of Computation Zohar Manna Winter 2010

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

CS20a: Turing Machines (Oct 29, 2002)

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

Propositional and Predicate Logic - XIII

Section 14.1 Computability then else

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem

Predicate Logic: Sematics Part 1

03 Review of First-Order Logic

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

CST Part IB. Computation Theory. Andrew Pitts

IV. Turing Machine. Yuxi Fu. BASICS, Shanghai Jiao Tong University

CSE 105 THEORY OF COMPUTATION

Great Theoretical Ideas

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Creative Objectivism, a powerful alternative to Constructivism

1 The decision problem for First order logic

23.1 Gödel Numberings and Diagonalization

(a) Definition of TMs. First Problem of URMs

17.1 The Halting Problem

Discrete Math in Computer Science Solutions to Practice Problems for Midterm 2

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Theory of Computer Science

CpSc 421 Homework 9 Solution

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

Chapter 2 Algorithms and Computation

258 Handbook of Discrete and Combinatorial Mathematics

Computability and Complexity

Herbrand Theorem, Equality, and Compactness

Institute for Applied Information Processing and Communications (IAIK) Secure & Correct Systems. Decidability

Limits of Computability

Turing Machines. Lecture 8

Undecidability of the validity problem

Lecture 13: Foundations of Math and Kolmogorov Complexity

Foundations of Logic Programming

Computation. Some history...

About the relationship between formal logic and complexity classes

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

CS21 Decidability and Tractability

Computability Theory. CS215, Lecture 6,

AN INTRODUCTION TO COMPUTABILITY THEORY

Propositional Logic: Syntax

Theory of Computer Science. Theory of Computer Science. D8.1 Other Halting Problem Variants. D8.2 Rice s Theorem

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Gödel s Incompleteness Theorem. Part II: Arithmetical Definability. Computability and Logic

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

CS 275 Automata and Formal Language Theory

ELEMENTS IN MATHEMATICS FOR INFORMATION SCIENCE NO.6 TURING MACHINE AND COMPUTABILITY. Tatsuya Hagino

the logic of provability

Overview of Topics. Finite Model Theory. Finite Model Theory. Connections to Database Theory. Qing Wang

Understanding Computation

Kvantifikator för en Dag

CS156: The Calculus of Computation Zohar Manna Winter 2010

Cogito ergo sum non machina!

1 Predicates and Quantifiers

First-Order Logic (FOL)

Theory of Computation

Theory of Computation

CS 275 Automata and Formal Language Theory

The Church-Turing Thesis and Relative Recursion

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Register machines L2 18

Logic and Computation

Introduction to Turing Machines. Reading: Chapters 8 & 9

TURING MAHINES

Turing Machine Recap

CPSC 421: Tutorial #1

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

6.8 The Post Correspondence Problem

Logic for Computer Scientists

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

Confusion of Memory. Lawrence S. Moss. Department of Mathematics Indiana University Bloomington, IN USA February 14, 2008

Decidability and Undecidability

Computability, Undeciability and the Halting Problem

Team Semantics and Recursive Enumerability

1 Acceptance, Rejection, and I/O for Turing Machines

Lecture 12: Mapping Reductions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

1 Showing Recognizability

5. Peano arithmetic and Gödel s incompleteness theorem

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Computable Functions

Lecture notes on Turing machines

Transcription:

CS402, Spring 2016

Undecidable Problems Does the following program halts? (1) N : n, total, x, y, z (2) n GetUserInput() (3) total 3 (4) while true (5) for x 1 to total 2 (6) for y 1 to total x 1 (7) z total x y (8) if x n + y n == z n then Halt() (9) total total + 1

Undecidability It would be nice to have an algorithm that could examine any program P and tell whether P would halt. We know that no such algorithm exists.

Halting Problem Theorem 1 (Simplified Halting Problem) Given an arbitrary program P and its input, string I, the halting problem is to write a program H that takes P and I as input, and prints true if P halts on I, and false otherwise. There does not exist a program that can solve the halting problem. That is, halting problem is undecidable.

Halting Problem Proof. Assume that there exists such a program H that can solve the halting problem. Then, using H, we can write the following program Z: Z(String x) (1) if H(x, x) then Loop forever (2) else Halt() Consider the case of Z(Z): Z halts on Z: by the assumption, H will return true. Consequently, Z will loop forever, and will not halt. Contradiction. Z loops forever on Z: by the assumption, H will return false. Consequently, Z will halt. Contradiction. Reductio ad absurdum.

Undecidability of Halting Problem It is undecidable to check whether a Turing machine (TM) will halt if started on a blank tape (halting problem). To prove the undecidability of predicate logic, we give an algorithm which produces a formula A TM in the predicate calculus for every Turing machine, s.t. A TM is valid iff a Turing machine halts. Note that we do not make a Turing machine M for every predicate formula, since it is enough to show that checking some predicate formulas is undecidable. If we have such an algorithm, it is clear that validity check of predicate formula is at least as hard as halting problem (i.e., undecidable).

Undecidability of Halting Problem For the sake of simplicity, let us work with Two Registers Machines (TRM) rathern than the vanilla Turing Machine. That is, we show that there exists such a formula A TRM for each TRM. Theorem 2 (5.42) Given a Turing machine that computes a function f, a two-register machine can be constructed to compute the same function f. Halts(TM) Halts(TRM), Halts(TRM) IsValid(A TRM )

A Two Register Machine, M Definition 1 (5.41) A two-register machine M consists of two registers x and y which can hold natural numbers, and a program P = (L 0,..., L n ) which is a list of instructions. L n is the instruction halt, and for 0 I < n, L i is one of: x x + 1 y y + 1 if x = 0 then goto L j else x x 1, 0 j n if y = 0 then goto L j else y y 1, 0 j n

A Two Register Machine, M An execution sequence of M is a sequence of states s k = (L ik, x, y), where L ik is the current instruction at s k, and x, y are the contents of x and y. s k+1 is obtained from s k by executing L ik. The initial state s 0 = (L i0, m, 0) = (L 0, m, 0) for some m. If for some k, s k = (L n, x, y), the computation of M has halted and M has computed y = f (m).

Example /* This program executes L 1 m times and halts */ L 0 :if x=0 then goto L 2 else x:=x-1 L 1 :if y=0 then goto L 0 else y:=y-1 L 2 :halt Execution with the initial value of x = 2: s 0 (L 0,2,0) s 1 (L 1,1,0) s 2 (L 0,1,0) s 3 (L 1,0,0) s 4 (L 0,0,0) s 5 (L 2,0,0)

Example /* L 0 is repeated infinitely. */ L 0 : x:=x+1 L 1 :if y=0 then goto L 0 else y:=y-1 L 2 :halt Execution with the initial value of x = 0: s 0 (L 0,0,0) s 1 (L 1,1,0) s 2 (L 0,1,0) s 3 (L 1,2,0) s 4 (L 0,2,0)

Validity of Predicate Calculus Theorem 3 (5.43. Church s Theorem) Validity in the predicate calculus is undecidable. Proof. Let M be an arbitrary two-register machine. We will construct a formula S M such that S M is valid iff M terminates when started in the state (L 0, 0, 0). The formula is: S M = ( p 0 (a, a) n 1 i=0 S i ) z 1 z 2 p n (z 1, z 2 )

Validity of Predicate Calculus Proof. Cont. where S i is defined based on L i : L i x x + 1 y y + 1 if x = 0 then goto L j else x x 1 if y = 0 then goto L j else y y 1 S i x y(p i (x, y) p i+1 (s(x), y)) x y(p i (x, y) p i+1 (x, s(y))) x(p i (a, x) p j (a, x)) x y(p i (s(x), y) p i+1 (x, y)) x(p i (x, a) p j (x, a)) x y(p i (x, s(y)) p i+1 (x, y)) Predicates p 0,..., p n correspond to statements in M. The implicit meaning of p i (x, y) is that the computation of M is at L i, and registers contain values x and y. The constant symbol a denotes 0, and the function s is the successor function (s(x) = x + 1).

Validity of Predicate Calculus Proof. Cont.: If M halts then S M is valid. Let s 0,..., s m be a computation of M that halts after m steps; we need to show that S M is valid, that is, that it is true under any interpretation for the formula. However, we need not consider every possible interpretation. If I is an interpretation for S M such that ν I (S i ) = F for some 0 i n 1 or such that ν I (p 0 (a, a)) = F, then trivially ν I (S M ) = T since the antecedent of S M is false. Therefore, we need only consider interpretations that satisfy the antecedent of S M. For such interpretations, we need to show that ν I ( z 1 z 2 p n(z 1, z 2 )) = T. We show by induction on k that ν I ( z 1 z 2 p ik (z 1, z 2 )) = T : If k = 0, trivially, p 0 (a, a) z 1 z 2 p i0 (z 1, z 2 ) z 1 z 2 p 0 (z 1, z 2 ). Let us assume the inductive hypothesis for k 1 and resolve the case when L k 1 is x x + 1. By assumption, the antecedent is true, in particular, its subformula S k 1 : ν I ( x y(p ik 1 (x, y) p ik +1(s(x), y))) = T By the inductive hypothesis: ν I ( z 1 z 2 p ik 1 (z 1, z 2 )) = T From which follows (by applying S k 1 above): ν I ( z 1 z 2 p ik +1(s(z 1 ), z 2 )) = T Let c 1 and c 2 be the domain elements assigned to z 1 and z 2, respectively, such that (succ(c 1 ), c 2 ) P k, where P k is the interpretation of p k and succ is the interpretation of s. Since c 3 = succ(c 1 ) for some domain element c 3, the existentially quantified formula in the consequent is true: ν I ( z 1 z 2 p ik +1(z 1, z 2 )) = T.

Validity of Predicate Calculus Proof. Cont. Note that Ben-Ari (both 2nd and 3rd edition) uses the wrong notation of p k and L k throughout the proof that we just went through (i.e., if M halts then S M is valid). The correct notations are p ik and L ik (both denoting instruction L i at kth state in execution). k is the index of states, while i is the index of instruction (which can be repeated during execution, hence the separate indexing). The induction only works when we separate these two. For example, consider the instruction that we skipped: suppose L i is if x = 0 then goto L j else else y y 1. The corresponding S i is: x(p i (a, x) p j (a, x)) x y(p i (s(x), y) p i+1 (x, y)). When the first conjunct holds (i.e. when x register contains 0), the instruction index suddenly jumps from i to j: following the original notation, the induction does not work, because j may not be i + 1. Once we separate the indices, the induction becomes much simpler. Another minor mistake in the book is that, when presenting the induction, instruction for s k 1 is incorrectly denoted as L k : it should have been L k 1.

Validity of Predicate Calculus Proof. Cont. If S M is valid then M halts: Suppose that S M is valid and consider the interpretation: I = (N, {P 0,..., P n}, {succ}, {0}) where succ is the successor function on N, and (x, y) P i iff (L i, x, y) is reached by the register machine when started in (L 0, 0, 0). We show by induction on the length of the computation that the antecedent of S M is true in I. The initial state is (L 0, 0, 0), so (a, a) P 0 and ν I (p 0 (a, a)) = T. The inductive hypothesis is that in state s k 1 = (L i, x i, y i ), (x i, y i ) P i. The inductive step is again by cases on the type of the instruction Li. For x = x + 1, s k = (L i+1, succ(x i ), y i ) and (succ(x i ), y i ) P i+1 by the definition of P i+1. Since S M is valid, ν I ( z 1 z 2 p n(z 1, z 2 )) = T and ν I (p n(m 1, m 2 )) = T for some m 1, m 2 N. By definition, (m 1, m 2 ) P n means that M halts and computes m 2 = f (0).

Incompleteness Definition 2 (Completeness) Let T (U) be a theory. T (U) is complete if and only if for every closed formula A, U A or U A. T (U) is incomplete iff it is not complete, that is, iff for some closed formula A, U A and U A. Theorem 4 (Gödel s Incompleteness Theorem) Let NT be the number theory (Peano arithmetic). If T (NT ) is consistent, then T (NT ) is incomplete.

Sketch of the Proof Gödel s proof relies on the definition of a mapping, called a Gödel numbering, from logical objects (such as formulas and proofs) to natural numbers. Note the recursive conceptual structure. Gödel first proves the following theorem: Theorem 5 (Provability) There exists a formula A(x, y) in NT with the following property: for any numbers i, j, A(i, j) is true if and only if i is the Gödel number associated with some formula B(x) with one free variable x, and j is the Gödel number associated with the proof of B(i). Furthermore, if A(i, j) is true, then a proof can be constructed for these specific integers, i.e., A(i, j). That is, A(i, j) means that j is the Gödel number for the proof of B(i). But then!

Incompleteness Consider C(x) = y A(x, y), with one free variable x. Let m be the Gödel number for C(x). Then, consider C(m) = y A(m, y), that is, for no y, y is the Gödel number of a proof of C(m)! Theorem 6 (Gödel) If NT is consistent, then C(m) and C(m). Proof. Suppose that C(m) = y A(m, y), and compute n, the Gödel number for this proof. Since this proof exists, A(m, n) is true. However, if C(m) is true, y A(m, y), therefore A(m, n). Contraction to the consistency of NT. Suppose that C(m) = y A(m, y) = ya(m, n). Then, for some n, A(m, n) is true, where n is the Gödel number of the proof of C(m) (the provability theorem). That is, C(m). This contradicts our assumption.