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

Similar documents
SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

The Unsolvability of the Halting Problem. Chapter 19

Decidability: Church-Turing Thesis

Turing Machines. Lecture 8

Introduction to Turing Machines. Reading: Chapters 8 & 9

A Universal Turing Machine

Lecture Notes: The Halting Problem; Reductions

Limits of Computability

Decidability: Reduction Proofs

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 8 1

Computational Models Lecture 8 1

1 Showing Recognizability

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

Computational Models Lecture 8 1

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Most General computer?

Turing Machines. Chapter 17

CS20a: Turing Machines (Oct 29, 2002)

17.1 The Halting Problem

CSE 105 THEORY OF COMPUTATION

CPSC 421: Tutorial #1

Functions on languages:

Decidability and Undecidability

Turing Machine Recap

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

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

CSE 105 THEORY OF COMPUTATION

Equivalent Variations of Turing Machines

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Languages, regular languages, finite automata

CSE 105 THEORY OF COMPUTATION

Computability and Complexity

Theory of Computation

CSCI3390-Assignment 2 Solutions

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

CSCE 551 Final Exam, Spring 2004 Answer Key

CpSc 421 Final Exam December 15, 2006

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

TURING MAHINES

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CSCC63 Worksheet Turing Machines

CSE 105 Theory of Computation

CpSc 421 Homework 9 Solution

Computability Theory. CS215, Lecture 6,

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

CS 7220 Computational Complexity and Algorithm Analysis

CS20a: Turing Machines (Oct 29, 2002)

CSCI3390-Lecture 6: An Undecidable Problem

Introduction to Turing Machines

Part I: Definitions and Properties

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.

Lecture 12: Mapping Reductions

Informal Statement Calculus

Non-emptiness Testing for TMs

Turing Machines Part III

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CSE 105 Theory of Computation

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

Further discussion of Turing machines

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Turing Machines. Wolfgang Schreiner

MA/CSSE 474 Theory of Computation

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

CSE 105 THEORY OF COMPUTATION

Theory of Computation

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Computability and Complexity

CSCE 551: Chin-Tser Huang. University of South Carolina

Undecidable Problems and Reducibility

CS 21 Decidability and Tractability Winter Solution Set 3

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Computational Models Lecture 9, Spring 2009

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Decidability (What, stuff is unsolvable?)

ACS2: Decidability Decidability

Homework 8. a b b a b a b. two-way, read/write

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Turing Machines, diagonalization, the halting problem, reducibility

1 Reducability. CSCC63 Worksheet Reducability. For your reference, A T M is defined to be the language { M, w M accepts w}. Theorem 5.

Computation Histories

Theory of Computer Science. Theory of Computer Science. D7.1 Introduction. D7.2 Turing Machines as Words. D7.3 Special Halting Problem

Reducability. Sipser, pages

Opleiding Informatica

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Decidable Languages - relationship with other classes.

CSE 105 THEORY OF COMPUTATION

Reductions in Computability Theory

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Automata Theory CS S-FR2 Final Review

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

4.2 The Halting Problem

Theory of Computation

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

Transcription:

Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM = {M M halts on all inputs} E TM ={M M is a TM and L(M)= } Halting easy for most, but: times3(x: positive integer) = While x 1 do: If x is even then x = x/2. else x = 3x + 1& Universe of discourse Semi-decidable A TM and H TM both semi-decidable using UTM. Show H TM not decidable. Easy to determine if have encoding of a TM, so we ll ignore it when take complements, etc., so our universe of discourse will only consider those with valid TM encodings. Let E be candidate TM to decide H TM. Show can t be right. From E, create TM D s.t. if input w, create <w,w> and simulate E on it (i.e, it treats input as if of form <M,w>) If E rejects then make D accept and if E accepts, D loops forever Now run D on <D,D> If <D,D> H TM then D halts on D, so E rejected <D,D> & <D,D> L(E) If <D,D> H TM then D not halt on D, so E accepted, <D,D> L(E) Either way, L(E) H TM with <D,D> in one but not other. Diagonal Argument

Decidable and Semidecidable If L and its complement are both semidecidable then it is decidable. Corollary: Complement of H TM is not semi-decidable Note, if H TM were decidable then every SD language would be decidable. Lots of other languages not decidable: L 0 = {<M,w> M on w eventually writes a 0}... Undecidability E TM ={M M is a TM and L(M)= } Spose decidable. For each pair <M,w> define machine M w that throws away its input and simulates M on w. Then M w E TM iff <M,w> H TM. Thus could use solution to E TM to solve H TM. Therefore E TM is not decidable. General procedure to show undecidability Reduce halting problem to solving other problem. Proofs are by contradiction Undecidability A Little Harder TOTAL TM ={M M is TM that halts on all inputs} Spose decidable. Use to solve halting! For each pair <M,w> define machine M w that throws away its input and simulates M on w. Then M w TOTAL TM iff <M,w> H TM. Thus could use solution to TOTAL TM to solve H TM. Therefore TOTAL TM is not decidable. L ε = {<M> M halts on empty tape} Given M, w, create machine M w that writes w and then simulates M on that w. Claim <M > L ε iff <M,w> H TM. Therefore L ε not decidable L 0 = { <M,w> M on w eventually prints 0 } L 0 = { M w s.t. M on w eventually prints 0 }

Another Example L ε0 = {<M> M on ε eventually writes a 0} Given M, rewrite to replace any occurrences of 0 in transitions by new character φ. If 0 in input alphabet make a first pass to replace all occurrences of 0 by φ. Modify again so that if it ever goes into a halt state then writes 0 on tape. Call it M One last modification: Erase input, write w, then run M on w. Call new machine M. Claim <M > L ε0 iff <M,w> H TM. Therefore L ε0 not decidable Entscheidungsproblem Turing s solution: First showed universal TM Essentially showed undecidability of halting problem Actually circle-free TM s (related to hmwk 3cd) Showed undecidability of determining if ever write 0 on empty input Can encode TM as a number (we did as string). Showed given TM M, can write a logical formula ψ of predicate logic such that ψ is true iff M writes 0 on ε Contradiction! Therefore not decidable Entscheidungsproblem Turing s solution last step: Given TM M, M and its computation can be described in predicate logic. Primitives: c is code of a configuration, square of tape One config follows from another via transition in M In c, TM is scanning square s, and s contains symbol y Write axioms about execution (depending on M): if M contains transition (p,a,q,b, ) then axiom: if M in config c w/state p, scanning square s containing a, then next config contains state q, s contains b, and M is scanning cell s+1. Entscheidungsproblem More on Turing s solution last step: Given TM M, can write a logical formula ψ of predicate logic such that ψ is true iff M writes 0 on ε input. Let ψ be statement: In some configuration of M starting with ε, some square s contains the symbol o Let φ 1,...,φ n be axioms for M. Then formula is φ 1... φ n ψ Thus M writes 0 on input ε iff φ 1... φ n ψ is provable in predicate calculus. Therefore provability undecidable!

Decidable & Semidecidable The Hierarchy SD D Context-Free Languages Regular Languages Theorem: The set of context-free languages is a proper subset of D. Proof: Every context-free language is decidable, so the context-free languages are a subset of D. There is at least one language, A n B n C n, that is decidable but not context-free. Distinguishing D and SD Outside of SD Most obvious languages in SD also in D A n B n C n = {a n b n c n n 0} {wcw w {a, b}*} {ww w {a, b}*} {w of form x y=z: x,y,z {0, 1}* and, when x, y, and z are viewed as binary numbers, xy = z} Uncountably many languages outside of SD Complement of H TM But already found some in gap, e.g. H TM

Closure Properties Equivalences to SD Theorem: D is closed under complement Proof: Let L ε D. Build TM deciding L... Proof depends on TM deterministic and always halts. What about SD? Not true for H TM A TM M enumerates the language L iff, for some fixed state p of M, L = {w : (s, ε) -M* (p, w)}. Potentia"y infinite computation. A language is Turing-enumerable iff there is a Turing machine that enumerates it. SD & Turing Enumerable SD & Turing Enumerable Theorem: A language is SD iff it is Turing enumerable. Proof: Spose L is Turing enumerable. Show L is SD. Let w be input. Start enumerating L. Every time enter state p, check to see if contents of tape is w. If yes then halt and stop. Otherwise keep going. Obvious proof in other direction not work! Theorem: A language is in SD iff it is Turing enumerable. Proof (cont): Spose L is in SD. Show L can be enumerated. Enumerate all w Σ* lexicographically: ε, a, b, aa, ab, ba, bb,... As each w i is enumerated, start a copy of M to check with w i as input. Execute one step of each M with w i started, excluding those that have halted Whenever an M accepts a w i, output w i. Called dove-tailing

Lexicographically Enumerable M lexicographica"y enumerates L iff M enumerates the elements of L in lexicographic order. A language L is lexicographica"y Turingenumerable iff there is a Turing machine that lexicographically enumerates it. Lexicographically Enumerable Theorem: A language is in D iff it is lexicographically enumerable. Proof: Spose L is in D. Show L can be enumerated lexicographically. Enumerate all w Σ* lexicographically: ε, a, b, aa, ab, ba, bb,... As each w i is enumerated, run M deciding L on w i as input. If M accepts a w i, output w i. Otherwise go to next. Easier here because M always halts Lexicographically Enumerable Theorem: A language is in D iff it is lexicographically enumerable. Proof: Spose L can be enumerated lexicographically. Show L is in D. To determine if w in L: Start enumerating all elts of L lexicographically If w is enumerated, then accept. If go past w in lexicographic order, then reject If halts before getting to w, then also reject. Oops! Second part of proof has a hole. Suppose M lexicographically enumerates L = {a,ba,aba} by enumerating three elements and then continuing forever without ever enumerating another element. Can only happen if L is finite. But all finite languages are decidable. Fixes proof But don t necessarily know whether L is finite!!