Transparency No. P3C2-1 Formal Language and Automata Theory PART III Chapter 2 Other Equivalent models of Standard Turing machine.

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

CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
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)
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Programming the TM qa  (,q) (,q) q1q1 0q1q1 R q1q1 1q1q1 R q1q1  h  Qa  (,q) (,q) q1q1 0q2q2  q1q1 1q3q3  q1q1  h  q2q2 0q4q4 R q2q2 1q4q4.
Lecture 5 Turing Machines
Computation Theory Introduction to Turing Machine.
Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Chapter 9 Turing Machine (TMs).
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
AUTOMATA THEORY VIII.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
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.
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.
1 More About Turing Machines “Programming Tricks” Restrictions Extensions Closure Properties.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
1 Turing Machines Reading: Chapter 8. 2 Turing Machines are… Very powerful (abstract) machines that could simulate any modern day computer (although very,
Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)
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,
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
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
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.
1 Chapter 9 Undecidability  Turing Machines Coded as Binary Strings  Universal Turing machine  Diagonalizing over Turing Machines  Problems as Languages.
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
1 8.4 Extensions to the Basic TM Extended TM’s to be studied: Multitape Turing machine Nondeterministic Turing machine The above extensions make no increase.
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
Universal Turing Machine
Chapters 11 and 12 Decision Problems and Undecidability.
Turing’s Thesis Costas Busch - LSU.
Turing Machines.
(Universal Turing Machine)
CSE 105 theory of computation
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
8. Introduction to Turing Machines
CS21 Decidability and Tractability
Decidability and Tractability
CSE 105 theory of computation
Variants of Turing machines
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Transparency No. P3C2-1 Formal Language and Automata Theory PART III Chapter 2 Other Equivalent models of Standard Turing machine

Equivalent TM models Transparency No. P3C3-2 Equivalent models of Turing machine multi-tape TMs 2way TMs multi-head TMs 2Dimensional TMs 2Stack machine Counter machine Nondeterministic TMs

Equivalent TM models Transparency No. P3C3-3 multi-tape TM A k-tape ( k  1) Turing machine is a 9-tuple M = (Q, , , ,  , , s, t,r ) where Q : is a finite set of (program) states like labels in traditional programs  : tape alphabet   : input alphabet    The left end-of-tape mark    is the blank tape symbol s  Q : initial state t  Q : the accept state r  t  Q: the reject state and  : (Q - {t,r})x  k --> Qx(  {L,R}) k is a total transition function with the restriction: if  (p, x 1,...,x k ) =(q, y 1,...,y k ) then if xj =  ==> y j = [ or R. i.e., the TM cannot overwrite other symbol at left-end and never move off the tape to the left.

Equivalent TM models Transparency No. P3C accept final state reject final state current state initial state control store (program) permitted actions: 1. read/write 2. move left/right depending on scanned symbols and current state 3-tape Turing machine x 1 x 2 x 3 x 4 x 5.. x n …. y 1 y 2 y 3 y 4 y 5.. y n …. z 1 z 2 z 3 z 4 z 5.. z n …. [ [ [

Equivalent TM models Transparency No. P3C3-5 Equivalence of STMs and Multi-tape TMs M = (Q, , , , , , s, t,r ): a k-tape TMs ==> M can be simulated by a k-track STM: M’ = (Q’, ,  ’, ,,  ’, s, t’,r’ ) where  ’=  U (  U  ) k where  = { a | a   }. M’ = init  M’’ where the task of Init is to convert initial input tape content : [x 1 x 2...x n   into and then go to the initial state s’’ of M’’ to start simulation of M. Each state q of M is simulated by a submachine M q of M’’ as follows: [ [ [ [ x 1 x 2... x n

Equivalent TM models Transparency No. P3C3-6 x 1 x 2 x 3 x 4 x 5.. x n …. [ y 1 y 2 y 3 y 4 y 5.. y n …. [ Q(q) x 1 x 2 x 3 x 4 x 5.. x n …. [ y 1 y 2 y 3 y 4 y 5.. y n …. [ Q’(q) [ is simulated by

Equivalent TM models Transparency No. P3C3-7 [ [ [ [ x 1 x 2... x n s’’ [ [ [ x 1 x 2... x n s’’ [ x 1 x 2 x 3... x n s Init simulate

Equivalent TM models Transparency No. P3C3-8 How does M’’ simulate M ? let (q, x 1, p 1, y 1 ),...,(q,x m,p m,y m ) be the set of all instructions (starting from state q) having the form  (q,x i ) = (p i,y i ). where x i,y i = (x i 1,x i 2,...,x i k ), (y i 1,y i 2,...,y i k ). Then M q behaves as follows: 1. [determine what symbols are scanned by tape heads] for j = 1 to k do { // determine symbol scanned by jth head move right until the symbol at the jth track is underlined, remember which symbol is underlined (say a j ) in the control store and then move to left end.} 2. [perform action:  (q, a 1,...,a k ) = (p, b 1,...,b k ) for each tape head] for j= 1 to k do{ // perform b j at the jth tape case1. b j = b  ==>MR until a j ; replace symbol a j at jth track by b j case2. b j = R ==>MR unitl a j, replace a j by a j and underline its right neighbor symbol. case3: b j = L. Similar to case 2. Finally move to left end. } 3. [go to next state] if p = t ==> accept; if p = r ==> reject; o/w go to start state of M p to simulate M at state p.

Equivalent TM models Transparency No. P3C3-9 Running time analysis How many steps of M’’ are needed to simulate one step of execution of M ? Sol: Assume the running time of M on input x of length n is f(n). step 1 requires time : O(k x 2 f(n)) Step 2 requires time: O( k x 2 f(n)) Step 3 requires O(1) time => Each step requires time O(4k x f(n)). and total time required to simulate M = f(n) x O(4k f(n)) = O (f(n) 2 ).

Equivalent TM models Transparency No. P3C3-10 Turing machine with 2 way infinite tape A 2way single tape Turing machine is a 8-tuple M = (Q, , , ,  , , s, t,r ) where Q : is a finite set of (program) states like labels in traditional programs  : tape alphabet   : input alphabet    The left end-of-tape mark (no longer needed!!)    is the blank tape symbol s  Q : initial state t  Q : the accept state r  t  Q: the reject state and  : (Q - {t,r})x  --> Qx(  {L,R}) is a total transition function.

Equivalent TM models Transparency No. P3C a b a a b b c c a b c c a a b b c c b b q 2 way infinite tape fold here! a b b c c a b c c a a b b c c b b a b a... [ (q, up) simulated by 1 way infinite tape

Equivalent TM models Transparency No. P3C3-12 M = (Q, , ,, , s, t,r ): a 2way TM ==> M can be simulated by a 2-track STM: M’ = (Q’, ,  ’, , ,  ’, s, t’,r’ ) where Q’ = Q U (Qx{u,d}) U {...},  ’=  U  2 U{ [ }, M’ = init  M’’ where the task of Init is to convert initial input tape content :  x 1 x 2...x n,  into and then go to the initial state s’’ of M’’ to start simulation of M. Each instruction of M is simulated by one or two instructions of M’’ as follows: Equivalence of STMs and 2way TMs [ x 1 x 2... x n

Equivalent TM models Transparency No. P3C3-13 How to simulate 2way tape TM using 1way tape TM Let  (q,x) = (p, y) be an instruction of M then: case 1: y   ==>  ’’((q,u), (x,z) ) =((p,u),(y,z)) and  ’’((q,d),(z,x)) = ((p,d), (z,y)) for all z   case2 : y = R. ==>  ’’((q,u), (x,z)) =((p,u),R) and  ’’((q,d),(z,x)) = ((p,d), L) for all z  . case 3: y = L. ==>  ’’((q,u), (x,z)) =((p,u),L) and  ’((q,d),(z,x)) = ((p,d), R) for all z  . additional conditions [left end==> change direction] : :  ’’((q,u), [) = ((q,d),R),  ’’((q,d),[)=((q,u),R) for all q  {t,r}.

Equivalent TM models Transparency No. P3C3-14 Properties of r.e. languages Theorem: If both L and ~L are r.e., then L ( and ~L) is recursive. Pf: Suppose L=L(M 1 ) and ~L = L(M 2 ) for two STM M 1 and M 2. Now construct a new 2 -tape TM M as follows: on input: x 1. copy x from tape 1 to tape 2. // COPY 2. Repeat { execute 1 step of M 1 on tape 1; execute 1 step of M 2 on tape 2 } until either M 1 accept or M 2 accept. 3. If M 1 accept then [M] accept If M 2 accept then [M] reject. // 2+3 = M 1 || M 2 defined later So if x  L => M 1 accept x => M accept if x  L => M 2 accept ==> M reject. Hence M is total and L =L(M) and L is recursive.

Equivalent TM models Transparency No. P3C3-15 Interleaved execution of two TMs M 1 = (Q 1, , , , ,  , s , t ,r  ) ; M 2 = (Q 2, , , , ,  2, s 2, t 2,r 2 ) where   : Q  x  --> Q  x (  U{L,R});  2 : Q 2 x  --> Q 2 x  U({L,R}); ==> M = def M  || M 2 = (Q  xQ 2 x{1,2}, , , , , ,s,T,R)where 1.  : Q  xQ  x{1,2}x  2 --> (Q  xQ 2 x{1,2}) x (  U{L,R}) 2 is given by Let   (q ,a) = (p ,a’) and  2 (q 2,b) = (p 2,b’) then  ((q ,q 2,1),(a,b)) = ((p ,q 2,2), a’,b) and  ((q ,q 2,2),(a,b)) = ((q ,p 2,1), a,b’) 2. M has initial state s = (s ,s ,1). 3. M has halting states T from M 1 : {(t ,q 2,1) | q 2  Q 2 } U {(r ,q 2,1) | q 2  Q 2 } and halting states R from M 2 : {(q ,t 2,2) | q   Q  } U {(q ,r 2,2) | q 1  Q 1 }. 4. By suitably designating halting states of M as accept or reject states, we can construct machine accepting languages that are boolean combination of L(M 1 ) and L(M 2 ).

Equivalent TM models Transparency No. P3C3-16 A programming Language for TMs and Universal TM Proposed Computation models TMs ( DTM, NDTM, RATM, multi-tape, 2way, multi Dimensional, multi-head, and their combinations,...) Grammars u-recursive function, -calculus Counter Machine 2STACK machine Post system,... All can be shown to have the same computation power Church-Turing Thesis: A language or function is computable iff it is Turing- computable (i.e., can be computed by a total TM). An algorithm is one that can be carried out by a total TM.

Equivalent TM models Transparency No. P3C3-17 Universal Turing machine TMs considered so far are dedicated in the sense that each of their control store is hard-wired to solve one particular problem e.g., TMs for +, x, copy,... Problem: Is there any TM that can compute what all TMs can compute ? Yes!! we call it universal TM (UTM), which is nothing special but a general-purpose TM. UTM is a TM simulator,i.e., given a spec “M” of a TM M and a desc “w”of an input w, UTM can simulate the execution of M on w. UTM (general-purpose computer) “w” (data) “M” (program) “M(w)”

Equivalent TM models Transparency No. P3C3-18 UTM (general-purpose computer) “w” (data) “M” (program) “M(w)”

Equivalent TM models Transparency No. P3C3-19 TL : a programming language for TMs M = (Q, , , ,  , , s, t,r ) : a STM. TM M can be described by a string (i.e., a TL-program) as follows: Tape symbols of M are encoded by strings from a{0,1}* blank(  ) ==> a0 left-end [ ==> a1 R ==> a00 L ==> a01 others => a10,a11,a000,a001,…. State symbols of M are encoded by strings from q{0,1}* start state s ==> q0; accept state t ==> q1, reject state r ==> q00; other states => q01,q10,q11, q111,… For b   U{R,L} U Q, we use e(b)  a{0,1}* U q{0,1}* to denote the encoding of b.

Equivalent TM models Transparency No. P3C3-20 An example M = (Q, , , ,  , , s, t,r ) where Q = {s, g, r,t },  = { [, a, } and  = { (s, a, g, ), (s,,t, ), (s, [, s, R), (g, a, s, a), (g, U, s, R), (g, [, r, R) } ==> Suppose state and tape symbols are represented in TL as follows: s => q0 ; t => q1; r => q00; g => q01  => a0; [ => a1; R => a00; L => a01; a => a10 Hence a string: ‘[aaa’   * can be encoded in TL as e([aaa) = “ [aaa ” = def a1a10a10a0a10

Equivalent TM models Transparency No. P3C3-21 Describe a TM by TL Let  = {  j |  j = (p j, a j, q j, b j ); j = 1..n} be the set of all instructions. ==> M can be encoded in TL as a string e(M) = “M”  {q,a,0,1,[, (,), , }* = def e(  1 ),e(  2 ),e(  3 ),...,e(  n ) where for j = 1 to n, e(  j ) = def ‘(‘ e(p j ) ‘,’ e(a j ) ‘,’ e(q j ) ‘,’ e(b j ) ‘)’ ex: for the previous example: we have  = { (s, a, g,  ), (s, ,t,  ), (s, [, s, R), (g, a, s, a), (g, U, s, R), (g, [, r, R) } hence e(M) =“M” = ‘(q0,a10,q01,a0),(q0,a0,q1,a0),......,(q01,a1,q00,a00)’

Equivalent TM models Transparency No. P3C3-22 TL and UTM U Let  0 = {q,a,0,1,(,), , } ==> the set of TL-programs, TL = def { x | x = e(M) for some STM M } is the set of all string representations of STMs. and    =  0 U { ,[ } is the tape alphabet of UTM U. Note: Not only encoding TMs, TL can also encode data. Relationship between TM, input and UTM: Note: if such U exists, then we need not implement other TMs STM M UTM U w M(w) e(M) e(w)e(M(w)) encoding decoding

Equivalent TM models Transparency No. P3C3-23 The design of UTM U We use U(e(M)e(w) ) to denote the result of UTM U on executing input e(M)e(w). U will be shown to have the property: for all machine M and input w, M halts on input w with result M(w) iff U halts on input e(M)e(w) with result e(M(w)) i.e., e(M(w)) = U(e(M)e(w)). U can be designed as a 3-tape TM. 1st tape : store input “M” “w”; used as the [only working ] tape of M and finally store the output. 2nd tape: store the program “M” 3rd tape: store the current state of M (program counter)

Equivalent TM models Transparency No. P3C3-24 U behaves as follows: 1. [Initially:] 1. copy “M” from 1st tape to 2nd tape. 2. shift “w” at the 1st tape down to the left-end 3. place ‘q0 I ’ at the 3rd tape (PC). 2. [simulation loop:] // between each simulation step, 2,3rd tape heads point to left-end; and 1st tape head points to the a pos of the encoded version of the symbol which M would be scanning. Each step of M is simulated by U as follows: 2.1 [halt or not] If PC =e(t) or e(r) ==> acept or reject, respectively. 2.2 [Instruction fetch] U scans its 2nd tape until it finds a tuple (q ,a ,q ,a ) s.t. (1) q  matches PC and (2) a  matches 1st tape’s encoded scanned symbol

Equivalent TM models Transparency No. P3C [Instruction execution] : 1. change PC to q . 2. perform action suggested by a. if a = e(b) with b  ==> write a at the 1st tape head pos. if a = e(L) ==> U move 1st tape head to the previous a position. if a = e(R) ==> U move 1st tape head to the next a position or append a0 J to the 1st tape in case such an ‘a’ cannot be found. Theorem: M(w) accepts, rejects or does not halt iff U(“M””w”) accepts, rejects or does not halt, respectively.