An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Similar documents
An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Pumping Lemma for CFLs

Cliff s notes for equivalence of CFLs and L(PDAs) LisaCFL L = L(M) for some PDA M L=L(M)forsomePDAM L = L(G) for some CFG G

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

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

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

V Honors Theory of Computation

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Further discussion of Turing machines

Computability and Complexity

Foundations of

CSE 105 THEORY OF COMPUTATION

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

CSCC63 Worksheet Turing Machines

CS4026 Formal Models of Computation

CS21 Decidability and Tractability

1 Unrestricted Computation

Introduction to Turing Machines

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

Chapter 3: The Church-Turing Thesis

Decidability and Undecidability

Computational Models Lecture 8 1

Part I: Definitions and Properties

Turing Machines. Lecture 8

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

Computational Models Lecture 8 1

Computational Models Lecture 8 1

Computability Theory. CS215, Lecture 6,

CSCE 551 Final Exam, Spring 2004 Answer Key

Chapter 8. Turing Machine (TMs)

Decidable Languages - relationship with other classes.

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

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

Theory of Computation

Homework Assignment 6 Answers

Turing Machines Part II

Decidability: Church-Turing Thesis

Turing Machines (TM) The Turing machine is the ultimate model of computation.

Most General computer?

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Introduction to Turing Machines. Reading: Chapters 8 & 9

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

1 Showing Recognizability

Turing Machines Part III

The Church-Turing Thesis

CPSC 421: Tutorial #1

CSE 105 THEORY OF COMPUTATION

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Turing Machines Part II

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

CSE 105 THEORY OF COMPUTATION

Lecture 12: Mapping Reductions

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Reducability. Sipser, pages

Complexity Theory Part I

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Turing Machines Part II

Undecidable Problems and Reducibility

Automata and Computability. Solutions to Exercises

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

Computation Histories

Variants of Turing Machine (intro)

Automata and Computability. Solutions to Exercises

Computational Models - Lecture 6

Decidable and undecidable languages

SCHEME FOR INTERNAL ASSESSMENT TEST 3

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Theory of Computation (IX) Yijia Chen Fudan University

The Turing machine model of computation

CSE 105 THEORY OF COMPUTATION

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

The Unsolvability of the Halting Problem. Chapter 19

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

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

CS154, Lecture 17: conp, Oracles again, Space Complexity

CS 525 Proof of Theorems 3.13 and 3.15

CSE 105 THEORY OF COMPUTATION

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

CSE 105 Theory of Computation

Non-emptiness Testing for TMs

Lecture 21: Space Complexity (The Final Exam Frontier?)

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

Computability and Complexity

Fundamentals of Computer Science

CSE 105 Theory of Computation

CP405 Theory of Computation

MA/CSSE 474 Theory of Computation

Complexity Theory Part II

Transcription:

Turing Machines Review An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Varieties of TMs Multi-Tape TMs Nondeterministic TMs String Enumerators 1 Turing Machines Blank part of tape Just like a DFA except: You have an infinite tape memory (or scratchpad) on which you receive your input and on which you can do your calculations You can read one symbol at a time from a cell on the tape, write one symbol, then move the read/write pointer (head) left (L) or right (R) 2

Who was Turing? Alan Turing (1912-1954): one of the most brilliant mathematicians of the 20 th century (one of the founding fathers of computing) Click on Theory Hall of Fame link on class web under Lectures Introduced the Turing machine as a formal model of what it means to compute and solve a problem (i.e. an algorithm ) Paper: On computable numbers, with an application to the Entscheidungsproblem, Proc. London Math. Soc. 42 (1936). 3 How do Turing Machines compute? δ(current state, symbol under the head) = (next state, symbol to write over current symbol, direction of head movement) Diagram shows: δ(q 1,1) = (q rej, 0, L) (R = right, L = left) In terms of Configurations : 110q 1 10 11q rej 000 4

Solving Problems with Turing Machines We know L = {0 n 1 n 0 n n 0} is not a CFL (pumping lemma) Show L is decidable Construct a decider M such that L(M) = L A decider is a TM that always halts (in q acc or q rej ) and is guaranteed not to go into an infinite loop for any input 5 Idea for a Decider for {0 n 1 n 0 n n 0} General Idea: Match each 0 with a 1 and a 0 following the 1. Implementation Level Description of a Decider for L: On input w: 1. If first symbol = blank, ACCEPT 2. If first symbol = 1, REJECT 3. If first symbol = 0, Write a blank to mark left end of tape a. If current symbol is 0 or X, skip until it is 1. REJECT if blank. b. Write X over 1. Skip 1 s/x s until you see 0. REJECT if blank. c. Write X over 0. Move back to left end of tape. 4. At left end: Skip X s until: a. You see 0: Write X over 0 and GOTO 3a b. You see 1: REJECT c. You see a blank space: ACCEPT 6

State Diagram 0 R q 0 _,R 0 q 1 X,R skip0 q 0 X,L skip1 q go-left X L 0 L 1 L 0 X,R Try running the decider on: 010, 001100, ACCEPT 0, 000, 0100, REJECT What about 010010? q ACC q at-left 7 Houston, we have a problem with our Turing machine. 8

What s the problem? 0 R q 0 _,R 0 q 1 X,R skip0 q 0 X,L skip1 q go-left X L 0 L 1 L q ACC 0 X,R q at-left The decider accepts incorrect strings: 010010, 010001100 ACCEPT!!! Accepts (0 n 1 n 0 n ) * Need to fix it How?? 9 A Simple Fix (to the Decider) Scan initially to make sure string is of the form 0*1*0* On input w: 1. If first symbol = blank, ACCEPT 2. If first symbol = 1, REJECT 3. If first symbol = 0: if w is not in 00*11*00*, REJECT; else, Write a blank to mark left end of tape Add this a. If current symbol is 0 or X, skip until it is 1. REJECT if blank. b. Write X over 1. Skip 1 s/x s until you see 0. REJECT if blank. c. Write X over 0. Move back to left end of tape. 4. At left end: Skip X s until: a. You see 0: Write X over 0 and GOTO 3a b. You see 1: REJECT c. You see a blank space: ACCEPT 10

The Decider TM for L in all its glory q 0 0 _,R 0 R 0 R 0 R q 1 q2 0 R q3 0 L 1 L q REW _ L q 1 X,R skip0 q 0 X,L skip1 q go-left New part tests for 00*11*00* X L 0 L 1 L q ACC 0 X,R q at-left 11 Varieties of TMs What if we allow multiple tapes? What if we allow nondeterminism? What if the TM explodes? 12

Various Types of TMs Multi-Tape TMs: TM with k tapes and k heads δ: Q Γ k Q Γ k {L,R} k δ(q i, a 1,, a k ) = (q j, b 1,, b k, L, R,, L) Nondeterministic TMs (NTMs) δ: Q Γ Pow(Q Γ {L,R}) δ(q i, a) = {(q 1, b, R), (q 2, c, L),, (q m, d, R)} Enumerator TM for L: Prints all strings in L (in any order, possibly with repetitions) and only the strings in L Other types: TM with Two-way infinite tape, TM with multiple heads on a single tape, 2D infinite tape TM, Random Access Memory (RAM) TM, etc. 13 Surprise! All TMs are born equal Each of the preceding TMs is equivalent to the standard TM They recognize the same set of languages (the Turingrecognizable languages) Proof idea: Simulate the deviant TM using a standard TM Example 1: Multi-tape TM on a standard TM Represent k tapes sequentially on 1 tape using separators # Use new symbol a to denote a head currently on symbol a 0 1........... b a h.......... 3 2 2.......... # 0 1 # b a h # 3 2 2 #....... (See text for details) 14

Example 2: Simulating Nondeterminism Any nondeterministic TM N can be simulated by a deterministic TM M NTMs: δ: Q Γ Pow(Q Γ {L,R}) No ε transitions but can simulate them by reading and writing same symbol N accepts w iff there is at least 1 path in N s tree for w ending in q ACC General proof idea: Simulate each branch sequentially Proof idea 1: Use depth first search? No, might go deep into an infinite branch and never explore other branches! Proof idea 2: Use breadth first search Explore all branches at depth n before n+1 a q 0 (q 1, b, R) (q 2, c, L) a b a q ACC This branch does not halt 15 Simulating Nondeterminism: Details, Details Use a 3-tape DTM M for breadthfirst traversal of N s tree on w: Tape 1 keeps the input string w Tape 2 stores N s tape during simulation along 1 path (given by tape 3) up to a particular depth, starting with w Tape 3 stores current path number E.g. ε = root node q 0 213 = path made up of 3 rd child of 1 st child of 2 nd child of root a q 0 a (q 1, b, R) (q 2, c, L) 213 q ACC See text for more details Does not halt 16

Next Class: We ll rap up Chapta 3 and move onto undecidability Have a great nondeterministic weekend! 17