CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

Variants of Turing machines
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Foundations of (Theoretical) Computer Science Chapter 3 Lecture Notes (Section 3.2: Variants of Turing Machines) David Martin With.
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
CS605 – The Mathematics and Theory of Computer Science Turing Machines.
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
Lecture 5 Turing Machines
Computation Theory Introduction to Turing Machine.
CHAPTER 4 Decidability Contents Decidable Languages
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
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.
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Turing Machines A more powerful computation model than a PDA ?
Turing Machines Chapter Plan Turing Machines(TMs) – Alan Turing Church-Turing Thesis – Definitions Computation Configuration Recognizable vs. Decidable.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Turing.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.
The Church-Turing Thesis Chapter 3 Giorgi Japaridze Theory of Computability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
The Church-Turing Thesis
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
More variants of Turing Machines
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Reducibility The Chinese University of Hong Kong Fall 2010
Turing Machines Acceptors; Enumerators
COSC 3340: Introduction to Theory of Computation
فصل سوم The Church-Turing Thesis
Decidable Languages Costas Busch - LSU.
Decidable and undecidable languages
CS21 Decidability and Tractability
More undecidable languages
Decidability and Tractability
Variants of Turing Machines
CSE 105 theory of computation
More undecidable languages
Variants of Turing machines
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants of Turing Machines Fall 2008

Recognizing versus deciding Looping is an undesirable behavior so we say –Such TM are called deciders The language recognized by a TM is the set of all inputs that make it reach q acc A TM decides language L if it recognizes L and does not loop on any input acceptrejectloop

Turing Machines state control … infinite tape 010 input Why is this a universal model of computation?

The Church-Turing Thesis “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936: Section 9. The extent of the computable numbers All arguments [for the CT Thesis] which can be given are bound to be, fundamentally, appeals to intuition, and for this reason rather unsatisfactory mathematically. The arguments which I shall use are of three kinds: 1. A direct appeal to intuition 2. A proof of the equivalence of two definitions (In case the new definition has greater intuitive appeal) 3. Giving examples of large classes of numbers which are computable.

Variant 1: The multitape Turing Machine The transition may depend on the contents of all the cells Different tape heads can be moved independently state control tape 1 … 010 tape 2 … 01 tape 3 … 100

Variant I: The multitape Turing Machine Multitape Turing Machines recognize the same languages as single-tape Turing Machines M … 010 … 01 … 100  = {0, 1, ☐ } S … 01010##0#10   ’ = {0, 1, ☐, 0, 1, ☐, #}   #

Variant I: The multitape Turing Machine For every transition in M, do following in S : Until you find the last #, Find the next dotted symbol Update this symbol according to transition in M Move the dot according to transition in M If there is no space to move the dot, Move everything to the right of the dot to make space first Move head of S to beginning of tape S … 01010##0#10   ’ = {0, 1, ☐, 0, 1, ☐, #}   #

Variant 2: The random access machine It has registers that can store arbitrary values, a program counter, and a random-access memory load -7 R 0 := -7 write R3 M[R 3 ] := R 0 store R5 R 5 := R 0 add R5 R 0 := R 0 + R 5 jpos 3 if R 0 > 0 then PC := 3 accept instructionmeaning PC 0 R0R0 0 R1R1 0 R2R2 2 M program counter registers memory …

Variant 2: The random access machine load -7 R 0 := -7 write R2 M[R 2 ] := R 0 save R1 R 1 := R 0 add R1 R 0 := R 0 + R 1 jzero 3 if R 0 = 0 then PC := 3 accept instructionmeaning PC 0 R0R0 0 R1R1 0 R2R2 0 M … The instructions are indexed by the program counter

Variant 2: The random access machine Simulating a Turing Machine on a RAM: Random assess machines recognize the same languages as Turing Machines PC 2 R0R0 1 M 2100 … M … 211 head tape

save R1 handle for state q 0 0 Simulating a TM on a RAM M q0q0 q1q1 q acc 1/2R … save R1 save head position read R1 read tape contents x add -1 jzero 6 if x = 1 goto line 6 load 2 new value of cell write R1 write in memory load R1 recall head position add 1 move head to right jump 30 go to state q 1 program … 211 save R1 handle for state q 1 … … … accept handle for state q acc

Simulating a RAM on a Turing Machine The configuration of a RAM consists of –Program counter –Contents of registers –Indices and contents of all nonempty memory cells 14 PC 3 R0R0 -7 R1R1 5 R2R2 2 M … configuration = (14, 3, -7, 5, (0, 2), (2, 1), (3, 2)) 0

Simulating a RAM on a Turing Machine The TM has a simulation tape and a scratch tape The simulation tape stores RAM configuration The TM has a set of states corresponding to each program instruction of the RAM The TM tape is updates according to RAM instruction (14,3,-7,5,(0,2),(2,1),(3,2)) M

Simulating a RAM on a Turing Machine Example: load R1 (14,3,-7,5,(0,2),(2,1),(3,2)) 2. Write R 1 to conf tape c 1. Copy R 1 to scratch tape -7 s (14,-,-7,5,(0,2),(2,1),(3,2)) -7 c s (14,-,-7,5,(0,2),(2,1),(3,2)) c c. c.. Make more space as needed (14,-7,-7,5,(0,2),(2,1),(3,2)) c 3. Erase scratch tape

Variant 3: Nondeterministic Turing Machine The transition function is nondeterministic: The language recognized by N are those strings that can lead N to end in q acc N … 010  : (Q – {q acc, q rej })   → subsets of (Q   {L, R})

Equivalence of NTM and TM Let us look more deeply into NTMs Nondeterministic Turing Machines recognize the same languages as Turing Machines q3q3 q5q5 1/2R q6q6 1/1L 1/1R Nondeterministic choices can be numbered ➀ ➁ ➂ The first m steps of the computation are then fully specified by a sequence of m numbers

Simulating a nondeterministic TM N … 100 k = maximum number of nondeterministic choices in any state M … 100 … 100 … 321 input tape 2 simulation tape address tape Address tape specifies nondeterministic choices of N First, input is copied from input tape to simulation tape Then, M simulates N using address tape data  ’ =  ∪ {1,..., k}

How to use the address tape Suppose N accepts x when nondeterminism = Then we want to make sure the address tape contains the string at some point in its execution N … 100 M … 100 … 100 … 321 input tape 2 simulation tape address tape To ensure this we try all possibilities for the address tape

Simulating a nondeterministic TM … 100 … 100 … 321 input tape x 2 simulation tape z address tape a Initially: x = input of N a is empty For all possible strings a : Copy x to z. Simulate N on input z using a as the nondeterminism If a specifies an invalid choice or simulation runs out of choices, abandon simulation. If N enters its accept state, accept and halt. If N enters its reject state, abandon simulation. Description of M:

Correctness of simulation If N accepts x : For all possible strings a : Copy x to z. Simulate N on input z using a as the nondeterminism If a specifies an invalid choice or simulation runs out of choices, abandon simulation. If N enters its accept state, accept and halt. If N enters its reject state, abandon simulation. Eventually, M will encounter the correct a Description of M: So M will accept Provided that all previous simulations halt!

Correctness of simulation Claim: Simulation step always halts (never loops) For all possible strings a : Copy x to z. Simulate N on input z using a as the nondeterminism If a specifies an invalid choice or simulation runs out of choices, abandon simulation. If N enters its accept state, accept and halt. If N enters its reject state, abandon simulation. Description of M: Since a is finite, the simulation will eventually run out of choices

Correctness of simulation If N does not accept x, then for every a : For all possible strings a : Copy x to z. Simulate N on input z using a as the nondeterminism If a specifies an invalid choice or simulation runs out of choices, abandon simulation. If N enters its accept state, accept and halt. If N enters its reject state, abandon simulation. Description of M: Either N will loop, so simulation runs out of choices Or N rejects, so simulation is abandoned anyway In either case, simulation fails, so M loops forever!

Context-free languages are recognizable Corollary In fact If L is context-free, then it is recognizable by a TM If L is context-free, then it is decided by some TM