Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.

Slides:



Advertisements
Similar presentations
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Advertisements

Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 19 Instructor: Paul Beame.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Great Theoretical Ideas in Computer Science for Some.
1 The Halting Problem and Decidability How powerful is a TM? Any program in a high level language can be simulated by a TM. Any algorithmic procedure carried.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
Halting Problem Introduction to Computing Science and Programming I.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
COMPSCI 102 Introduction to Discrete Mathematics.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
Great Theoretical Ideas in Computer Science.
CSE 311 Foundations of Computing I Lecture 26 Cardinality, Countability & Computability Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 25 Pattern Matching, Cardinality, Computability Spring
CSE 311: Foundations of Computing Fall 2013 Lecture 26: Pattern matching, cardinality.
CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Introduction to Turing Machines
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Fall 2014 Lecture 29: Turing machines and more decidability CSE 311: Foundations of Computing.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
The Acceptance Problem for TMs
Introduction to Computing Science and Programming I
CSE 311 Foundations of Computing I
Lecture12 The Halting Problem
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
Homework: Friday Read Section 4.1. In particular, you must understand the proofs of Theorems 4.1, 4.2, 4.3, and 4.4, so you can do this homework. Exercises.
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
CSCE 411 Design and Analysis of Algorithms
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
CSE 311 Foundations of Computing I
Theory of Computation Turing Machines.
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
CSE 311: Foundations of Computing
Formal Languages, Automata and Models of Computation
Recall last lecture and Nondeterministic TMs
Class 24: Computability Halting Problems Hockey Team Logo
CS21 Decidability and Tractability
CSE 105 theory of computation
Subject Name: FORMAL LANGUAGES AND AUTOMATA THEORY
CSE 311: Foundations of Computing
CO Games Development 2 Week 21 Turing Machines & Computability
Lecture 4: Unsolvable Problems
Turing Machines Everything is an Integer
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing

highlights Cardinality A set S is countable iff we can write it as S={s 1, s 2, s 3,...} indexed by ℕ Set of rationals is countable – “dovetailing” Σ* is countable – {0,1}* = {λ,0,1,00,01,10,11,000,001,010,011,100,101,...} Set of all (Java) programs is countable 1/11/21/31/41/51/61/71/8... 2/12/22/32/42/52/62/72/8... 3/13/23/33/43/53/63/73/8... 4/14/24/34/44/54/64/74/8... 5/15/25/35/45/55/65/7... 6/16/26/36/46/56/6... 7/17/27/37/47/

what about the real numbers? Q: Is every set is countable? A: Theorem [Cantor] The set of real numbers (even just between 0 and 1) is NOT countable Proof is by contradiction using a new method called diagonalization

proof by contradiction Suppose that ℝ [0,1) is countable Then there is some listing of all elements ℝ [0,1) = { r 1, r 2, r 3, r 4,... } We will prove that in such a listing there must be at least one missing element which contradicts statement “ ℝ [0,1) is countable” The missing element will be found by looking at the decimal expansions of r 1, r 2, r 3, r 4,...

real numbers between 0 and 1: ℝ [0,1) Every number between 0 and 1 has an infinite decimal expansion: 1/2 = /3 = /7 = π -3 = /5 = =

representations of real numbers as decimals Representation is unique except for the cases that decimal ends in all 0’s or all 9’s. x = x = x = 1.8 so x= Won’t allow the representations ending in all 9’s All other representations give different elements of ℝ [0,1)

supposed listing of ℝ [0,1) r1r r2r r3r r4r r5r r6r r7r r8r

supposed listing of ℝ [0,1) r1r r2r r3r r4r r5r r6r r7r r8r

flipped diagonal r1r r2r r3r r4r r5r r6r r7r r8r Flipping Rule: If digit is 5, make it 1 If digit is not 5, make it 5

flipped diagonal number D D = But for all n, we have D  r n since they differ on n th digit (which is not 9) ⇒ list was incomplete ⇒ ℝ [0,1) is not countable D is in ℝ [0,1)

why doesn’t this show that the rationals aren’t countable? The set of real numbers is not countable flipped diagonal number D

the set of all functions f : ℕ→ {0,1,...,9} is not countable

highlights There exist functions that cannot be computed by any program – The set of all functions f : ℕ→ {0,1,...,9} is not countable – The set of all (Java/C/C++) programs is countable – So there are simply more functions than programs

do we care? Are any of these functions, ones that we would actually want to compute? – The argument does not even give any example of something that can’t be done, it just says that such an example exists We haven’t used much of anything about what computers (programs or people) can do – Once we figure that out, we’ll be able to show that some of these functions are really important

before Java…more from our brief history of reasoning 1930’s – How can we formalize what algorithms are possible? Turing machines (Turing, Post) basis of modern computers Lambda Calculus (Church) basis for functional programming  - recursive functions (Kleene) alternative functional programming basis All are equivalent!

turing machines Church-Turing Thesis Any reasonable model of computation that includes all possible algorithms is equivalent in power to a Turing machine Evidence – Intuitive justification – Huge numbers of equivalent models to TM’s based on radically different ideas

components of Turing’s intuitive model of computation Finite Control – Brain/CPU that has only a finite # of possible “states of mind” Recording medium – An unlimited supply of blank “scratch paper” on which to write & read symbols, each chosen from a finite set of possibilities – Input also supplied on the scratch paper Focus of attention – Finite control can only focus on a small portion of the recording medium at once – Focus of attention can only shift a small amount at a time

what is a Turing machine?

Recording medium – An infinite read/write “tape” marked off into cells – Each cell can store one symbol or be “blank” – Tape is initially all blank except a few cells of the tape containing the input string – Read/write head can scan one cell of the tape - starts on input In each step, a Turing machine – Reads the currently scanned symbol – Based on state of mind and scanned symbol Overwrites symbol in scanned cell Moves read/write head left or right one cell Changes to a new state Each Turing Machine is specified by its finite set of rules

sample Turing machine __ __ _01 s1s1 (1,s 3 )(1,s 2 )(0,s 2 ) s2s2 (H,s 3 )(R,s 1 ) s3s3 (H,s 3 )(R,s 3 )

what is a Turing machine?

turing machine ≡ ideal Java/C program Ideal C/C++/Java programs – Just like the C/C++/Java you’re used to programming with, except you never run out of memory constructor methods always succeed malloc never fails Equivalent to Turing machines except a lot easier to program ! – Turing machine definition is useful for breaking computation down into simplest steps – We only care about high level so we use programs

turing’s big idea: machines as data Original Turing machine definition – A different “machine” M for each task – Each machine M is defined by a finite set of possible operations on finite set of symbols M has a finite description as a sequence of symbols, its “code” You already are used to this idea: – We’ll write for the code of program P – i.e. is the program text as a sequence of ASCII symbols and P is what actually executes

turing’s idea: a universal turing machine A Turing machine interpreter U – On input and its input x, U outputs the same thing as P does on input x – At each step it decodes which operation P would have performed and simulates it. One Turing machine is enough – Basis for modern stored-program computer Von Neumann studied Turing’s UTM design P input x output P(x) U x output P(x) PP

halting problem Given: the code of a program P and an input x for P, i.e. given (,x) Output: 1 if P halts on input x 0 if P does not halt on input x Theorem (Turing): There is no program that solves the halting problem “The halting problem is undecidable”

proof by contradiction Suppose that H is a Turing machine that solves the Halting problem Function D(x): if H(x,x)=1 then while (true); /* loop forever */ else no-op; /* do nothing and halt */ endif What does D do on input ? – Does it halt?

proof by contradiction Function D(x): if H(x,x)=1 then – while (true); /* loop forever */ else – no-op; /* do nothing and halt */ Endif` Does D halt on input ? D halts on input ⇔ H outputs 1 on input (, ) [since H solves the halting problem and so H(,x) outputs 1 iff D halts on input x ] ⇔ D runs forever on input [since D goes into an infinite loop on x iff H(x,x)=1 ] This is contradiction. Our only assumption was that H exists.

that’s it! We proved that there is no computer program that can solve the Halting Problem. This tells us that there is no compiler that can check our programs and guarantee to find any infinite loops they might have