Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.

Slides:



Advertisements
Similar presentations
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Advertisements

1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Introduction to Computability Theory
Transparency No. 2-1 Formal Language and Automata Theory Chapter 2 Deterministic Finite Automata (DFA) (include Lecture 3 and 4)
Theory of Computation What types of things are computable? How can we demonstrate what things are computable?
Transparency No. P2C3-1 Formal Language and Automata Theory Chapter 3 Pushdown Automata and Context-Free Languages.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Transparency No. P3C3-1 Formal Language and Automata Theory Part III Turing Machines and Effective Computability.
Transparency No. P3C3-1 Formal Language and Automata Theory Part III Turing Machines and Effective Computability.
Transparency No. P2C3-1 Formal Language and Automata Theory Chapter 3 Pushdown Automata and Context-Free Languages.
Transparency No. P2C3-1 Formal Language and Automata Theory Chapter 3 Pushdown Automata and Context-Free Languages.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?

Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.
Foundations of (Theoretical) Computer Science Chapter 4 Lecture Notes (Section 4.1: Decidable Languages) David Martin With modifications.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Normal forms for Context-Free Grammars
Transparency No. P2C1-1 Formal Language and Automata Theory Part II Pushdown Automata and Context-Free Languages.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
Fall 2006Costas Busch - RPI1 The Chomsky Hierarchy.
Fall 2003Costas Busch - RPI1 Turing Machines (TMs) Linear Bounded Automata (LBAs)
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Chapter 9 Turing Machine (TMs).
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
TM Design Universal TM MA/CSSE 474 Theory of Computation.
Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
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.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
© M. Winter COSC/MATH 4P61 - Theory of Computation CFL are closed under Substitution Union Concatenation Closure (*) Homomorphism Reversal Intersection.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
Recursively Enumerable Languages
Discrete Structures ICS252 Chapter 5 Lecture 2. Languages and Grammars prepared By sabiha begum.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
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.
1 Course Overview Why this course “formal languages and automata theory?” What do computers really do? What are the practical benefits/application of formal.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
Transparency No. P3C2-1 Formal Language and Automata Theory PART III Chapter 2 Other Equivalent models of Standard Turing machine.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Lecture 6: Context-Free Languages
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Theory of Languages and Automata By: Mojtaba Khezrian.
Transparency No. 1 Formal Language and Automata Theory Homework 6.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Chapters 11 and 12 Decision Problems and Undecidability.
Busch Complexity Lectures: Turing Machines
Turing Machines.
Natural Language Processing - Formal Language -
Context Sensitive Languages and Linear Bounded Automata
Turing Machines Chapter 17.
Summary.
Jaya Krishna, M.Tech, Assistant Professor
CSE 105 theory of computation
CS21 Decidability and Tractability
Decidability and Tractability
Presentation transcript:

Transparency No. P3C1-1 Turing Machines PART III Turing Machines and Effective Computability

Transparency No. P3C1-2 Turing Machines PART III Chapter 1 Turing Machines

Transparency No. P3C1-3 Turing machines the most powerful automata (> FAs and PDAs ) invented by Turing in 1936 can compute any function normally considered computable Turing-Church Thesis: Turing-Church Thesis Anything (function, problem, set etc.) that is (though to be) computable is computable by a Turing machine (i.e., Turing-computable). Other equivalent formalisms: post systems post systems (string rewriting system)string rewriting system Formal Grammars Formal Grammars (Chomsky Hierarchy): on stringsChomsky Hierarchy  -recursive function  -recursive function : on numbers -calculus -calculus, combinatory logic: on -termcombinatory logic C, BASIC, PASCAL, JAVA languages,… : on strings

Turing Machines Transparency No. P3C1-4 Informal description of a Turing machine 1. Finite automata (DFAs, NFAs, etc.): limited input tape: one-way, read-only no working-memory finite-control store (program) 2. PDAs: limited input tape: one-way, read-only one additional stack as working memory finite-control store (program) 3. Turing machines (TMs): a semi-infinite tape storing input and supplying additional working storage. finite control store (program) can read/write and two-way(move left and right) depending on the program state and input symbol scanned.

Turing Machines Transparency No. P3C1-5 Turing machines and LBAs 4. Linear bounded automata (LBA): special TMsLinear bounded automata the input tape is of the same size as the input length (i.e., no additional memory supplied except those used to store the input) can read/write and move left/right depending on the program state and input symbol scanned. Primitive instructions of a TM (like +,-,*, etc in C or BASIC): 1. L, R // moving the tape head left or right 2. a  , // write the symbol a   on the current scanned position depending on the precondition: 1. current state and 2. current scanned symbol of the tape head

Turing Machines Transparency No. P3C1-6 left-end x 1 x 2 x 3 x 4 x 5.. x n input: x …. additional working memory.... accept final state reject final state current state initial state control store (program) r/w & movable tape head memory is a one-dimensional tape permitted actions: 1. write 2. move left/right depending on scanned symbol and current state The model of a Turing machine no right-end for TM

Turing Machines Transparency No. P3C1-7 The structure of a TM instruction: An instruction of a TM is a tuple: (q, a, p, d)  Q x  x Q x (  U {L,R}) where q is the current state a is the symbol scanned by the tape head (q,a) defines a precondition that the machine may encounter (p,d) specify the actions to be done by the TM once the machine is in a condition matching the precondition (i.e., the symbol scanned by the tape head is ‘a’ and the machine is at state q ) p is the next state that the TM will enter d is the action to be performed:  d = b   means “write the symbol b to the tape cell currently scanned by the tape head”.  d = R (or L) means “move the tape head one tape cell in the right (or left, respectively) direction. A Deterministic TM program  is simply a set of TM instructions (or more formally a function:  : Q x  --> Qx (  U{L,R}))

Turing Machines Transparency No. P3C1-8 Formal Definition of a standard TM (STM) A deterministic 1-tape Turing machine (STM) is a 9-tuple M = (Q, , , ,  , , s, t,r ) where Q : is a finite set of (program) states with a role 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  --> Qx(  U {L,R}) is a total transition function with the restriction: if  (p,  ) =(q, d) then d = R. i.e., the STM cannot write any symbol at left-end and never move off the tape to the left.

Turing Machines Transparency No. P3C1-9 Configurations and acceptances Issue: h/w to define configurations like those defined in FAs and PDAs ? At any time t 0 the TM M’s tape contains a semi-infinite string of the form Tape(t 0 ) =  y 1 y 2 …y m        ….. (y m  ) Let    denotes the semi-infinite string:          ….. Note: Although the tape  is an infinite string, it has a finite canonical representation: y, where y =  y 1 …y m (with y m   ) A configuration of the TM M is a global state giving a snapshot of all relevant info about M’s computation at some instance in time.

Turing Machines Transparency No. P3C1-10 Formal definition of a configuration Def: a cfg of a STM M is an element of CF M = def Q x {  y | y      } x N // N = {0,1,2,…} // When the machine M is at cfg (p, z, n), it means M is 1. at state p 2. Tape head is pointing to position n and 3. the input tape content is z. Obviously cfg gives us sufficient information to continue the execution of the machine. Def: 1. [Initial configuration:] Given an input x and a STM M, the initial configuration of M on input x is the triple: (s,  x, 0) 2. If cfg1 = (p, y, n), then cfg1 is an accept configuration if p = t (the accept configuration), and cfg1 is an reject cfg if p = r ( the reject cfg). cfg1 is a halting cfg if it is an accept or reject cfg.

Turing Machines Transparency No. P3C1-11 One-step and multi-step TM computations one-step Turing computation ( |-- M ) is defined as follows: |-- M  CF M 2 is the least binary relation over CF M s.t. 0. (p,z,n) |-- M (q,s n b (z), n) if  (p,z n ) = (q, b) where b   1. (p,z,n) |-- M (q,z, n-1) if  (p,z n ) = (q, L) 2. (p,z,n) |-- M (q,z, n+1) if  (p,z n ) = (q, R) where s n b (z) is the resulting string with the n-th symbol of z replaced by ‘b’. ex: s 4 b (  baaacabc ) =  baabcabc s 6 b (  baa ) =  baa  b |-- M is defined to be the set of all pairs of configurations each satisfying one of the above three rules. Notes: 1. if C=(p,z,n) |-- M (q,y,m) then n  0 and m  0 (why?) 2. |-- M is a function [from nonhalting cfgs to cfgs] (i.e., if C |-- M D & C |-- M E then D=E). 3. define |-- n M and |--* M (ref. and tran. closure of |-- M ) as usual.

Turing Machines Transparency No. P3C1-12 Accepting and rejecting of TM on inputs x   is said to be accepted by a STM M if icfg M (x) = def (s,  x, 0) |--* M (t,y,n) for some y and n I.e, there is a finite computation (s,  x, 0) = C 0 |-- M C 1 |-- M …. |-- M C k = (t,_,_) starting from the initial configuration and ending at an accept configuration. x is said to be rejected by a STM M if (s,  x, 0) |--* M (r,y,n) for some y and n I.e, there is a finite computation (s,  x, 0) = C 0 |-- M C 1 |-- M …. |-- M C k = (t,_,_) starting from the initial configuration and ending at a reject configuration. Notes: 1. It is impossible that x is both accepted and rejected by a STM. (why ?) 2. It is possible that x is neither accepted nor rejected. (why ?)

Turing Machines Transparency No. P3C1-13 Languages accepted by a STM Def: 1. M is said to halt on input x if either M accepts x or rejects x. 2. M is said to loop on x if it does not halt on x. 3. A TM is said to be total if it halts on all inputs. 4. The language accepted by a TM M, L(M) = def {x in  * | x is accepted by M, i.e., (s,  x  ,0) |--* M (t, -,-) } 5. If L = L(M) for some STM M ==> L is said to be recursively enumerable (r.e.) 6. If L = L(M) for some total STM M ==> L is said to be recursive 7. If ~ L= def  * - L = L(M) for some STM M (or total STM M) ==> L is said to be Co-r.e. (or Co-recursive, respectively)

Turing Machines Transparency No. P3C1-14 Some examples Ex1: Find a STM to accept L 1 = { w # w | w  {a,b}* } note: L 1 is not a CFL. The STM has tape alphabet  = {a, b,#, -,  ,  } and behaves as follows: on input z : (Hopefully of the form: w # w  {a,b,#}* ) 1. if z is not of the form {a,b} * # {a,b} * => goto reject 2. move left until ‘  ‘ is encountered and in that case move right 3. while I/P (i.e., symbol scanned by input head) = ‘-’ move right; 4. if I/P = ‘a’ then 4.1 write ‘-’; move right until # is encountered; Move right; 4.2 while I/P = ‘-’ move right 4.3 case (I/P) of { ‘a’ : (write ‘-’; goto 2); o/w: goto reject } 5. if I/p = ‘b’ then … // like 4.1~ If I/P = ‘#’ then // All symbols left to # have been compared 6.1 move right 6.2 while I/P = ‘-” move right 6.3 case (I/P) of {‘ ’  : goto Accept; o/w: go to Reject }

Turing Machines Transparency No. P3C1-15 More detail of the STM Step 1 can be accomplished as follows: 1.1 while I/P matches (~# /\ ~  ) R; // i.e, I/P  # and I/P   //or equivalently, while I/P matches (a \/ b\/ [ \/ - ) R if  => reject // no # found on the input if # => R; 1.2 While ( ~# /\ ~   ) R; if   => goto accept [or goto 2 if regarded as a subroutine] if # => goto Reject; // more than one #s found Step 1 requires only two states:

Turing Machines Transparency No. P3C1-16 Graphical representation of a TM R ~# /\ ~  R # t r R R  #  s u ACs cnd p q means: if (state = p) /\ (cnd true for I/P) then 1. perform ACs and 2. go to q ACs can be primitive ones: R, L, a,… or another subroutine TM M 1. Ex: the arc from s to s in the left graph implies the existence of 4 instructions: (s, a, s, R), (s,b,s,R), (s, ,s,R), and (s,-, s,R)

Turing Machines Transparency No. P3C1-17 Tabular form of a STM Translation of the graphical form to tabular form of a STM The rows for t & r indeed need not be listed!!  Q 

Turing Machines Transparency No. P3C1-18 The complete STM accepting L 1 R ~# /\ ~  R # r R R  #  L ~~  R RR R R R R - ~# - a - ~a r r t ~# # b -  ~  /\~- # b  x a # r ~b step 1. step 2. step 3. step 4. step 5. step

Turing Machines Transparency No. P3C1-19 R.e. and recursive languages Recall the following definitions: 1. M is said to halt on input x if either M accepts x or rejects x. 2. M is said to loop on x if it does not halt on x. 3. A TM is said to be total if it halts on all inputs. 4. The language accepted by a TM M, L(M) = def {x ∈  * | x is accepted by M, i.e., (s,  x   ,0) |--* M (t, -,-) } 5. If L = L(M) for some STM M ==> L is said to be recursively enumerable (r.e.) 6. If L = L(M) for some total STM M ==> L is said to be recursive 7. If ~ L= def  * - L = L(M) for some STM M (or total STM M) ==> L is said to be Co-r.e. (or Co-recursive, respectively)

Turing Machines Transparency No. P3C1-20 Recursive languages are closed under complement Theorem 1: Recursive languages are closed under complement. (i.e., If L is recursive, then ~L =  * - L is recursive.) pf: Suppose L is recursive. Then L = L(M) for some total TM M. Now let M* be the machine M with accept and reject states switched (i.e., the accepting state t* of M* is r of M, while rejecting state r* of M* is t of M ). Now for any input x, x  ~L => x  L(M) => icfg M (x) |- M * (t,-,-) => icfg M* (x) |- M* * (r*,-,-) => x  L(M*). x  ~L => x  L(M) => icfg M (x) |- M * (r,-,-) => icfg M* (x) |- M* * (t*,-,-) => x  L(M*). Hence ~L = L(M*) and is recursive. Note.The same argument cannot be applied to r.e. languages. (why?) Exercise: Are recursive sets closed under union, intersection, concatenation and/or Kleene’s operation ?

Turing Machines Transparency No. P3C1-21 Some more termonology Set : Recursive and recursively enumerable(r.e.) predicate: Decidability and semidecidability Problem: Solvability and semisolvabilty P : a statement about strings ( or a property of strings) A: a set of strings Q : a (decision) Problem. We say that 1. P is decidable { x | P(x) is true } is recursive 2. A is recursive “x  A” is decidable. 3. P is semidecidable { x | P(x) is true } is r.e. 4. A is r.e. “x  A” is semidecidable. 5. Q is solvable Rep(Q) = def {“P” | P is a positive instance of Q } is recursive. 6. Q is semisolvale Rep(Q) is r.e..

Turing Machines Transparency No. P3C1-22 The Chomsky Hierarchy Relationship of Languages, Grammars and machines Languagerecognition modelgeneration model Regular languages; type 3 languages Finite automata (DFA, NFA) regular expressions type 3(right linear, regular) grammar context-free language (CFL) ; type 2 languages Pushdown automataContext free grammar (CFG) ; type 2 grammar context-sensitive language (CFL) ; type 1 languages LBA (Linear Bounded Automata) Context sensitive grammar(CSG) ; type 1 Grammar Recursive LanguagesTotal Turing machines- R.E. (Recursively enumerative ) language; type 0 language Turing machinestype 0 grammar ; unrestricted grammar

Turing Machines Transparency No. P3C1-23 The Chomsky Hierarchy type 3 (regular langs) CFLs (type 2 langs) CSLs (type 1 Langs) Recursive Languages Recursively Enumerable(type 0) languages All Languages

Turing Machines Transparency No. P3C1-24 Phrase-structure (unrestricted) grammar Def.: A unrestricted grammar G is a tuple G=(N, , S, P) where N, , and S are the same as for CFG, and P, a finite subset of (NU  )* N (NU  )* x (NU  )*, is a set of production rules of the form:    where  ∈ (NU  )* N (NU  )* is a string over (NU  )* containing at least on nonterminal.  ∈ (NU  )* is a string over (NU  )*. Def: G is of type 1 (context-sensitive) if S   or |  | ≤ |  |. 2 (context-free) if  ∈ N and    or S  . 3 (right linear) if every rule is one of the forms:  A  a B or A  a (a ≠  ) or S  .

Turing Machines Transparency No. P3C1-25 Derivations Derivation  G ⊆ (NU  )* x (NU  )* is the least set of pairs such that : ∀ x,y ∈  UN)*,    ∈ P, x  y  G x  y. Let  * G be the ref. and tran. closure of  G. L(G) : the languages generated by grammar G is the set: L(G) = def {x ∈  * | S  * G x }

Turing Machines Transparency No. P3C1-26 Example Design CSG to generate the language L={0 n 1 n 2 n | n ≥ 0 }, which is known to be not context free. Sol: Consider the CSG G 1 with the following productions: S  , S  0SA22A  A2, 0A  011A  11 For G 1 we have S  0SA2  …  0 k (A2) k  * 0 k A k 2 k  0 k 1 k 2 k ∴ L ⊆ L(G1). Also note that if S  *  then #0(  ) = #(A|1)(  ) = #(2)(  ). if S  *  ∈ {0,1,2}* then   k = 0 implies  j = 0 for all j < k.   k = 1 implies  j = 1 or 0 for all j < k. where  k is the k-th symbol in string  k. Hence  must be of the form 0*1*2* =>  ∈ L. QED