Logic and Computation

Similar documents
Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

23.1 Gödel Numberings and Diagonalization

Turing Machine Recap

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

Computation. Some history...

Notes for Lecture Notes 2

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

1 Computational Problems

Decidability: Church-Turing Thesis

Informal Statement Calculus

CSCI3390-Lecture 6: An Undecidable Problem

Understanding Computation

Cantor and sets: La diagonale du fou

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

Final Exam (100 points)

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

1 Reals are Uncountable

Lecture Notes: The Halting Problem; Reductions

Part II. Logic and Set Theory. Year

CS3719 Theory of Computation and Algorithms

ACS2: Decidability Decidability

MATH 3300 Test 1. Name: Student Id:

Selected problems from past exams

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

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

16.1 Countability. CS125 Lecture 16 Fall 2014

CS6901: review of Theory of Computation and Algorithms

Logic: The Big Picture

CITS2211 Discrete Structures (2017) Cardinality and Countability

Arithmetic and Incompleteness. Will Gunther. Goals. Coding with Naturals. Logic and Incompleteness. Will Gunther. February 6, 2013

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

17.1 The Halting Problem

CSE 105 THEORY OF COMPUTATION

2.2 Lowenheim-Skolem-Tarski theorems

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

The constructible universe

Part II Logic and Set Theory

14 Uncountable Sets(Denial of Self Recursion)

Logic: Propositional Logic Truth Tables

Economics 204 Summer/Fall 2017 Lecture 1 Monday July 17, 2017

1 Showing Recognizability

Great Theoretical Ideas

About the relationship between formal logic and complexity classes

GÖDEL S COMPLETENESS AND INCOMPLETENESS THEOREMS. Contents 1. Introduction Gödel s Completeness Theorem

15-251: Great Theoretical Ideas in Computer Science Fall 2016 Lecture 6 September 15, Turing & the Uncomputable

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

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

Herbrand Theorem, Equality, and Compactness

03 Review of First-Order Logic

Predicate Logic - Undecidability

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

NP-completeness. Chapter 34. Sergey Bereg

by Yurii Khomskii There is a weaker notion called semi-representability:

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Complexity Theory Part I

CS481F01 Solutions 8

Great Theoretical Ideas in Computer Science. Lecture 5: Cantor s Legacy

CPSC 421: Tutorial #1

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

Turing Machines. Lecture 8

6.8 The Post Correspondence Problem

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Limits of Computability

Uncountable computable model theory

Friendly Logics, Fall 2015, Lecture Notes 1

Sections 8.1 & 8.2 Systems of Linear Equations in Two Variables

Classical Propositional Logic

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

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

Undecibability. Hilbert's 10th Problem: Give an algorithm that given a polynomial decides if the polynomial has integer roots or not.

Hilbert s problems, Gödel, and the limits of computation

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

Most General computer?

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

4.2 The Halting Problem

CSE 311: Foundations of Computing. Lecture 26: Cardinality

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

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

Handbook of Logic and Proof Techniques for Computer Science

COMPUTER SCIENCE TRIPOS

Foundations of Computer Science Lecture 23 Languages: What is Computation?

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CSE 311: Foundations of Computing. Lecture 27: Undecidability

Economics 204 Fall 2011 Problem Set 1 Suggested Solutions

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

Properties of Relational Logic

Gödel s Theorem: Limits of logic and computation

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

CMPSCI 601: Tarski s Truth Definition Lecture 15. where

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

CS6902 Theory of Computation and Algorithms

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

Part I: Definitions and Properties

Section 14.1 Computability then else

Recap (1) 1. Automata, grammars and other formalisms can be considered as mechanical devices to solve mathematical problems

1 Completeness Theorem for First Order Logic

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

On some Metatheorems about FOL

Transcription:

Logic and Computation CS245 Dr. Borzoo Bonakdarpour University of Waterloo (Fall 2012) Computability and Decidability Logic and Computation p. 1/29

Agenda Programs as Formulas Cantor s Diagonalization Decidability Logic and Computation p. 2/29

Programs as Formulas Addition x.plus(0, x, x) x,y,z.plus(x,y,z) PLUS(s(x),y,s(z)) where s is the successor function in the set of natural numbers. Logic and Computation p. 3/29

Programs as Formulas Strings x.append([],x,x) x,y,z,h.append(x,y,z) APPEND(h x,y,h z) where denotes concatenation of two strings. Logic and Computation p. 4/29

Programs as Formulas For a program P with the APPEND axioms show that P = APPEND([a,b],[c],[a,b,c]). Hint: Proof by resolution. Logic and Computation p. 5/29

Programs as Formulas Reverse x.reverse([],x,x) x,y,z,w.reverse(y,x z,w) REVERSE(x y, z, w) Logic and Computation p. 6/29

Programs as Formulas Storage x,y,z.lookup(x,y,cell(x,y,z)) x,y,x,y,z.lookup(x,y,z) LOOKUP(x,y,cell(x,y,z)) Logic and Computation p. 7/29

Decidability A set is decidable iff there exists a formula ϕ(x) such that: ϕ(t) for t S ϕ(t) for t S Question: Is the set of terms of FOL decidable? I.e., can we describe FOL by itself? To answer this question, we should first learn whether a given set is countable. Because if we want to describe an uncountable set by a Logic and Computation p. 8/29 countable set, we will fail!

Countable Sets Recall that a set S is countable if there is a one-to-one correspondance between S and the N of natural numbers. How do we prove that a set is uncountable? Logic and Computation p. 9/29

Cantor s Diagonal Argument Considers an infinite sequence S = (s 1,s 2,...), where each element s i is an infinite sequence of 1s or 0s. Each sequence s i is countable (why?): s 1 = (0,0,0,0,0,0,0,...) s 2 = (1,1,1,1,1,1,1,...) s 3 = (0,1,0,1,0,1,0,...) s 4 = (1,0,1,0,1,0,1,...) s 5 = (1,1,0,1,0,1,1,...) s 6 = (0,0,1,1,0,1,1,...) s 7 = (1,0,0,0,1,0,0,...)... Logic and Computation p. 10/29

Diagonalization It is possible to build a sequence s in such a way that if s n,n = 1, then s n = 0, otherwise s n = 1. s 1 = (0,0,0,0,0,0,0,...) s 2 = (1,1,1,1,1,1,1,...) s 3 = (0,1,0,1,0,1,0,...) s 4 = (1,0,1,0,1,0,1,...) s 5 = (1,1,0,1,0,1,1,...) s 6 = (0,0,1,1,0,1,1,...) s 7 = (1,0,0,0,1,0,0,...)... s = (1,0,1,1,1,0,1,...) Logic and Computation p. 11/29

Diagonalization By definition, s is not contained in the countable sequence S. Let T be a set consisting of all infinite sequences of 0s and 1s. By definition, T must contain S and s. Since s is not in S, T cannot coincide with S. Therefore, T is uncountable because it cannot be placed in one-to-one correspondence with N. Logic and Computation p. 12/29

R is Uncountable We build a one-to-one correspondance between T and a subset of R. Let function f(t) = 0.t, where t is a string in T. For example, f(0111...) = 0.0111... Observe that f(1000...) = 0.1000 = 1/2, and f(0111...) = 0.0111 = 1/4+1/8+1/16+ = 1/2. Hence, f is not a bijection. Logic and Computation p. 13/29

R is Uncountable To produce a bijection from T to the interval (0,1): From (0, 1), remove the numbers having two binary expansions and form a = (1/2,1/4,3/4,1/8,3/8,5/8,7/8, ). From T, remove the strings appearing after the binary point in the binary expansions of 0, 1, and the numbers in sequence a and form b = (000,111,1000, 0111,01000,00111, ). g(t) from T to (0,1) is defined by: If t is the nth string in sequence b, let g(t) be the nth number in sequence a; otherwise, let g(t) = 0.t. Logic and Computation p. 14/29

R is Uncountable To build a bijection from T to R, we use tan(x), a bijection from ( π/2, π/2) to R. The linear function h(x) = π.x π/2 provides a bijection from (0, 1) to ( π/2, π/2). The composite function tan(h(x)) provides a bijection from (0,1) to R. Function tan(h(g(t))) is a bijection from T to R. Logic and Computation p. 15/29

Diagonalization Using diagonalization, one can also show that (for example): Q = N = Z N < 2 N The set of all functions from N to N is uncountable. Logic and Computation p. 16/29

Gödel Numbering A Gödel numbering is a function that assigns to each symbol and well-formed formula of some formal language a unique natural number, called its Gödel number. There are several ways to do this: Prime factorization ASCII code Logic and Computation p. 17/29

Gödel Numbering Moral of the story: each FOL formula ϕ is represented by a unique natural number ϕ. So what?! Recall that N < 2 N? This means we have too many sets and too few formulas! This is the core idea of undecidability of FOL. Logic and Computation p. 18/29

Decision Problems Any question about a function can be converted to a yes/no" problem. This is called a decision problem. For example: Find a path a path from s to t in a graph G Does there exist a path from s to t in G? Compute function f(n) Decide whether f(n) = m Or ask whether R f ( n, m ) Logic and Computation p. 19/29

Decision Problems and Decidability Consider the following validity question: P R(t 1,...,t n ). Three possible answers are: There is a proof (e.g., using FOL resolution). There is no proof (e.g., using a counter example). This means we have a proof of P R. We cannot tell (i.e., the proof system loops). For example x.p(x) P(s(x)) This question is equal to that of decidability/undecidability. Logic and Computation p. 20/29

Decidability of FOL Theorem. The set VALID = { ϕ ϕ} is undecidable. Proof sketch. This means that: ϕ then VALID( ϕ ) ϕ then VALID( ϕ ) Assume that VALID(x) is a formula. Logic and Computation p. 21/29

Diagonalization for FOL (ϕ 1 ) ϕ 2 x ϕ 1 ϕ 2 ϕ 3... ϕ 1... ϕ 2... ϕ 3............... ϕ d... Logic and Computation p. 22/29

Diagonalization for FOL Note that DIAG(t, x.ϕ t (x = t) ) is decidable. ϕ d = y.(diag(x,y) VALID(y)) Diagonal argument: ϕ( ϕ d ) ϕ d = y.(diag( ϕ d,y) VALID(y)) VALID( ϕ d ( ϕ d ) ) ϕ( ϕ d ) Logic and Computation p. 23/29

Reducibility A reduction is a transformation of one problem into another problem. We normally reduce problem 1 to problem 2, because we know how to solve problem 2 and this gives us the answer to problem 1. Logic and Computation p. 24/29

Reducibility Recall graph connectivity, cyclicity, and vertex cover problems in application of the compactness theorem? An important consequence of reducibility is to show that two problems belong to the same class (e.g., undecidable). Logic and Computation p. 25/29

Another Example Reduction from propositional satifiability to vertex cover: (p q) ( p q r) ( p q r) p p q q r r p p p p q q r q r Logic and Computation p. 26/29

The Halting Problem Let HALTS( P ) be a program that returns true if P halts (recall that a programm P can be encoded as a first-order formula). Theorem. The halting problem, is undecidable. Logic and Computation p. 27/29

Undecidability of HALT Let RESOLUTION( ϕ ) be the problem that implements resolution for FOL. I.e., it returns true if ϕ. Then the program if HALTS(RESOLUTION( x )), then EVAL(RESOLUTION(x)), else false is a decision procedure for VALID. In other words, if we could solve the halting problem, we could have solved the FOL validity problem. Logic and Computation p. 28/29

Gödel s Incompleteness Theroems Theorem 1. For any consistent, effectively generated formal theory that proves certain basic arithmetic truths, there is an arithmetical statement that is true, but not provable in the theory. Theorem 2. For any formal effectively generated theory T including basic arithmetical truths and also certain truths about formal provability, if T includes a statement of its own consistency then T is inconsistent. Logic and Computation p. 29/29