CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring 2013 1.

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]
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
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?
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
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.
Turing Machines A more powerful computation model than a PDA ?
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.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
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.
Halting Problem Introduction to Computing Science and Programming I.
Turing Machines. Intro to Turing Machines A Turing Machine (TM) has finite-state control (like PDA), and an infinite read-write tape. The tape serves.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
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)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
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.
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
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.
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
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.
1 Chapter 9 Undecidability  Turing Machines Coded as Binary Strings  Universal Turing machine  Diagonalizing over Turing Machines  Problems as Languages.
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
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.
1 Recursively Enumerable and Recursive Languages.
Fall 2013 Lecture 27: Turing machines and 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.
Introduction to Computing Science and Programming I
CSE 311 Foundations of Computing I
Chapter 9 TURING MACHINES.
COSC 3340: Introduction to Theory of Computation
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSCE 411 Design and Analysis of Algorithms
CSE 311 Foundations of Computing I
Theory of Computation Turing Machines.
Decidable Languages Costas Busch - LSU.
CSE 311: Foundations of Computing
Formal Languages, Automata and Models of Computation
Recall last lecture and Nondeterministic TMs
CSE 311: Foundations of Computing
CO Games Development 2 Week 21 Turing Machines & Computability
Turing Machines Everything is an Integer
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring

Announcements Reading – 7th edition: p. 201 and 13.5 – 6th edition: p. 177 and 12.5 Topic list and sample final exam problems have been posted Final exam, Monday, June 10 – 2:30-4:20 pm MGH

Last lecture 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 3 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/

Last lecture highlights The set of real numbers is not countable – “diagonalization” – Why doesn’t this show that the rationals aren’t countable? 4

Last lecture 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 5

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 6

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! 7

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 8

Components of Turing’s Intuitive Model of Computers 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 9

What is a Turing Machine? 10

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 11

Sample Turing Machine __11011__ 12 _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? 13

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 14

Turing’s 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 15

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 16

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” 17

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? 18

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] 19 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 ?

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 20