CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Introduction to Computability Theory
The Halting Problem Sipser 4.2 (pages ). CS 311 Mount Holyoke College 2 Taking stock All languages Turing-recognizable Turing-decidable Context-free.
The Halting Problem Sipser 4.2 (pages ).
CSCI 2670 Introduction to Theory of Computing October 19, 2005.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Decidability. Why study un-solvability? When a problem is algorithmically unsolvable, we realize that the problem must be simplified or altered before.
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
CHAPTER 4 Decidability Contents Decidable Languages
CS 310 – Fall 2006 Pacific University CS310 Decidability Section 4.1/4.2 November 10, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 6 Decidability Jan Maluszynski, IDA, 2007
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
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.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Cardinality of Sets Section 2.5.
Announcements Homework – HW8 due Tues 5/29 11am – HW5 grades are out Monday is Memorial Day; no office hours, etc. – Go see a parade, or some fireworks,
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Copyright © Cengage Learning. All rights reserved. CHAPTER 7 FUNCTIONS.
Computer Language Theory
A Universal Turing Machine
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
D E C I D A B I L I T Y 1. 2 Objectives To investigate the power of algorithms to solve problems. To explore the limits of algorithmic solvability. To.
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
CS 461 – Nov. 7 Decidability concepts –Countable = can number the elements  –Uncountable = numbering scheme impossible  –A TM undecidable –Language classes.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
Section 2.5. Cardinality Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z + ) is called countable.
Foundations of (Theoretical) Computer Science Chapter 4 Lecture Notes (Section 4.2: The “Halting” Problem) David Martin With modifications.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
The Acceptance Problem for TMs
A Universal Turing Machine
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
This statement is false.
CSCI 2670 Introduction to Theory of Computing
Lecture12 The Halting Problem
CSCI 2670 Introduction to Theory of Computing
BCS 2143 Theory of Computer Science
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
Formal Languages, Automata and Models of Computation
Intro to Theory of Computation
Recall last lecture and Nondeterministic TMs
CS21 Decidability and Tractability
Theory of Computability
Theory of Computability
CSCI 2670 Introduction to Theory of Computing
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
Theory of Computability
Instructor: Aaron Roth
Intro to Theory of Computation
Presentation transcript:

CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006

CS 310 – Fall 2006 Pacific University Will it ever stop? A TM = { | M is a TM and M accepts w } –undecidable –remember, decidable means that the TM will eventually reach an accept or reject state; it will halt –U is a Universal TM –TM U recognizes A TM : 1. Simulate M on input w with U 2. If M accepts then U accepts; if M rejects then U rejects; if M never halts then U never halts If we could get U to halt, then we could get M to halt

CS 310 – Fall 2006 Pacific University Counting Diagonalization –how can we determine if two infinite sets are the same size? (Georg Cantor) –cannot just count them up –the two sets are the same size if the elements of one set can be paired with the elements from the other set (no counting!) –define a function as a correspondence

CS 310 – Fall 2006 Pacific University Correspondence A and B are sets, F is a function from A to B; F: A  B –Fis one-to-one if it never maps two different elements to the same place, if F(a)  F(c) whenever a  c –F is onto if it hits every element of B, for each b  B this is an a  A such that F(a) = b –A and B are the same size if there is a one-to- one, onto function F –F is a correspondence

CS 310 – Fall 2006 Pacific University Application Let N be the set of natural numbers, let E be the set of even natural numbers. If we can find a correspondence function between these two infinite sets, the are the same size –f(n) = 2n Definition: a set is countable if it is finite or in correspondence with the set of natural numbers

CS 310 – Fall 2006 Pacific University Diagonialization Is Q = { m/n | m,n  N } countable? –can we find a correspondence? –We can make a list of all the elements in Q, and match them with the elements in N 1/1 1 1/2 3 1/3 5 1/41/5 2/1 2 2/22/32/42/5 3/1 4 3/23/33/43/5 4/14/24/34/44/5 5/15/25/35/45/5 We cannot just go down the first row because…

CS 310 – Fall 2006 Pacific University What could ever be uncountable? The set of Real Numbers, R Proof by contradiction –assume R is countable –there must exists a correspondence function f with the set N –find some number x  R that is not paired with a number p  N –we will construct this number x

CS 310 – Fall 2006 Pacific University Real Numbers are uncountable Assume F exists Construct x such x ≠f(p) for any p x is between 0 and 1 ensure x ≠f(1), set the 10 th s’ place to 4 ensure x ≠f(2), set the 100 th s’ place to 6 –forever…. –never select 0 or 9 since.1999… =.2000 * we know x ≠f(p) for any p since x differs from f(p) in the p th decimal place * on the exam prove this for 3 points extra credit pf(p) … … …

CS 310 – Fall 2006 Pacific University Why do we care? Some languages are not TM recognizable –show that the set of all TMs is countable each TM recognizes exactly one language –show that the set of all languages is not countable –some language must not match to a TM –for a finite alphabet, ,  * is countable a finite set of strings of each length

CS 310 – Fall 2006 Pacific University Some languages are not TM recog. show that the set of all TMs is countable –the set of all TM is countable because each TM, M, can be encoded into a string, –omit all strings that are not valid TMs show that the set of all languages is not –set of all infinite binary sequences, B, is uncountable, using proof by contradiction similar to Real Numbers

CS 310 – Fall 2006 Pacific University Encode TM as string Assume  = {0, 1};  = {0, 1,  } Encode elements of  using 1s –  (q i, x) = (q j, y, M) is en(q i )0en(x)0en(q j )0en(y)0en(M) –two 0s separate transitions, beginning and end marked with 000 q 0 is start q 1 is accept q n-1 is reject We could build a TM to check to see if a string is a legal encoding of a deterministic TM –what does that language look like? Zen(Z)  111 q0q0 1

CS 310 – Fall 2006 Pacific University The Halting Problem, Proof A TM = { | M is a TM and M accepts w } –undecidable, may never halt –assume A TM is decidable and that H is a TM decider (always halts) for A TM –on input : accept if M accepts w rejects if M does not accept w H( )

CS 310 – Fall 2006 Pacific University The Halting Problem, Proof, cont. Construct a TM, D, with H as subroutine. D calls H to determine what M does when input is its encoding. Once D determines, it does the opposite. –D = On input, where M is a TM 1)Run H on > 2)If H accepts, reject. If H rejects, accept. accept if D does not accept reject if D accepts Contradiction! We can use diagonalization to explore this further D( )