Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.

Slides:



Advertisements
Similar presentations
Restricted Machines Presented by Muhannad Harrim.
Advertisements

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.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Simulating a modern computer by a Turing machine and vice versa CS 6800 Instructor: Dr. Elise de Doncker By Shweta Gowda Saikiran Ponnam.
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Turing Machines.

CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Finite State Machines Data Structures and Algorithms for Information Processing 1.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Chapter 9 Turing Machine (TMs).
Complexity and Computability Theory I Lecture #13 Instructor: Rina Zviel-Girshin Lea Epstein Yael Moses.
Undecidability Everything is an Integer Countable and Uncountable Sets
Turing Machines Recursive and Recursively Enumerable Languages
CSE202: Introduction to Formal Languages and Automata Theory Chapter 9 The Turing Machine These class notes are based on material from our textbook, An.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
TM Design Universal TM MA/CSSE 474 Theory of Computation.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
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 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1 Design a PDA which accepts: L= { a n b m : n ≠ m }
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Turing Machines Lecture 26 Naveen Z Quazilbash. Overview Introduction Turing Machine Notation Turing Machine Formal Notation Transition Function Instantaneous.
Lecture 14 Push Down Automata (PDA) Topics:  Definition  Moves of the PDA  Languages of the PDA  Deterministic PDA’s June 18, 2015 CSCE 355 Foundations.
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.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
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.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Lecture 23 Turing Machines Topics: Pumping Lemma for CFL Example Chomsky hierarchy What’s Computable ? Turing Machines November 24, 2008 CSCE 355 Foundations.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Lecture 16 Cocke-Younger-Kasimi Parsing Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE.
Formal Languages, Automata and Models of Computation
8. Introduction to Turing Machines
Recursively Enumerable and Recursive Languages
Lecture 14 Push Down Automata (PDA)
Busch Complexity Lectures: Turing Machines
Linear Bounded Automata LBAs
Turing Machines.
CSCE 355 Foundations of Computation
Pushdown Automata PDAs
Pushdown Automata PDAs
PDAs Accept Context-Free Languages
Pushdown Automata PDAs
Turing Machines 2nd 2017 Lecture 9.
Turing Machines Acceptors; Enumerators
CSE322 Chomsky classification
Jaya Krishna, M.Tech, Assistant Professor
Decidable Languages Costas Busch - LSU.
8. Introduction to Turing Machines
Deterministic PDAs - DPDAs
Pushdown automata a_introduction.htm.
CS21 Decidability and Tractability
Recall last lecture and Nondeterministic TMs
Decidability and Tractability
Hopcroft, Motawi, Ullman, Chap 8
Turing Machines Everything is an Integer
Presentation transcript:

Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations of Computation

– 2 – CSCE 355 Summer 2015 ialc slides Ullman Stanford 2010 Chomsky Hierarchy GrammarLanguagesAutomatonProduction rules (constraints) Type-0Recursively enumerableTuring machine α  β no restrictions Type-1Context-sensitiveLinear-bounded non- deterministic Turing machine αAβ  αγβ Type-2Context-freeNon-deterministic pushdown automaton pushdown automaton A  α Type-3RegularDFA A  a or A  aB

– 3 – CSCE 355 Summer 2015 ialc slides Ullman Stanford 2010 Alan Turing

– 4 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Turing-Machine Theory  The purpose of the theory of Turing machines is to prove that certain specific languages have no algorithm.  Start with a language about Turing machines themselves.  Reductions are used to prove more common questions undecidable.

– 5 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Picture of a Turing Machine State... ABCAD Infinite tape with squares containing tape symbols chosen from a finite alphabet Action: based on the state and the tape symbol under the head: change state, rewrite the symbol and move the head one square.

– 6 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Why Turing Machines?  Why not deal with C programs or something like that?  Answer: You can, but it is easier to prove things about TM’s, because they are so simple. And yet they are as powerful as any computer. More so, in fact, since they have infinite memory.

– 7 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Then Why Not Finite-State Machines to Model Computers?  In principle, you could, but it is not instructive.  Programming models don’t build in a limit on memory.  In practice, you can go to Fry’s and buy another disk.  But finite automata vital at the chip level (model- checking).

– 8 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Turing-Machine Formalism  A TM is described by: 1. A finite set of states (Q, typically). 2. An input alphabet ( Σ, typically). 3. A tape alphabet ( Γ, typically; contains Σ ). 4. A transition function ( δ, typically). 5. A start state (q 0, in Q, typically). 6. A blank symbol (B, in Γ- Σ, typically).  All tape except for the input is blank initially. 7. A set of final states (F ⊆ Q, typically).

– 9 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Conventions  a, b, … are input symbols.  …, X, Y, Z are tape symbols.  …, w, x, y, z are strings of input symbols.  , ,… are strings of tape symbols.

– 10 – CSCE 355 Summer 2015 ialc slides Ullman Stanford The Transition Function  Takes two arguments: 1. A state, in Q. 2. A tape symbol in Γ.  δ (q, Z) is either undefined or a triple of the form (p, Y, D). p is a state, the next state. Y is the new tape symbol, replacing the Z. D is a direction, L or R.

– 11 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Actions of the PDA  If δ (q, Z) = (p, Y, D) then, in state q, scanning Z under its tape head, the TM: 1. Changes the state to p. 2. Replaces Z by Y on the tape. 3. Moves the head one square in direction D.  D = L: move left; D = R; move right.

– 12 – CSCE 355 Summer 2015 ialc slides Ullman Stanford 2010 Example reformatted

– 13 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Example: Turing Machine  This TM scans its input right, looking for a 1.  If it finds one, it changes it to a 0, goes to final state f, and halts.  If it reaches a blank, it changes it to a 1 and moves left.

– 14 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Example: Turing Machine – (2)  States = {q (start), f (final)}.  Input symbols = {0, 1}.  Tape symbols = {0, 1, B}.  δ (q, 0) = (q, 0, R).  δ (q, 1) = (f, 0, R).  δ (q, B) = (q, 1, L).

– 15 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L)... B B 0 0 B B... q

– 16 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L)... B B 0 0 B B... q

– 17 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L) q... B B 0 0 B B...

– 18 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L) q... B B B...

– 19 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L) q... B B B...

– 20 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Simulation of TM δ (q, 0) = (q, 0, R) δ (q, 1) = (f, 0, R) δ (q, B) = (q, 1, L) f No move is possible. The TM halts and accepts.... B B B...

– 21 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Instantaneous Descriptions of a Turing Machine  Initially, a TM has a tape consisting of a string of input symbols surrounded by an infinity of blanks in both directions.  The TM is in the start state, and the head is at the leftmost input symbol.

– 22 – CSCE 355 Summer 2015 ialc slides Ullman Stanford TM ID’s – (2)  An ID is a string  q , where  is the tape between the leftmost and rightmost nonblanks (inclusive).  The state q is immediately to the left of the tape symbol scanned.  If q is at the right end, it is scanning B. If q is scanning a B at the left end, then consecutive B’s at and to the right of q are part of .

– 23 – CSCE 355 Summer 2015 ialc slides Ullman Stanford TM ID’s – (3)  As for PDA’s we may use symbols ⊦ and ⊦ * to represent “becomes in one move” and “becomes in zero or more moves,” respectively, on ID’s.  Example: The moves of the previous TM are q00 ⊦ 0q0 ⊦ 00q ⊦ 0q01 ⊦ 00q1 ⊦ 000f

– 24 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Formal Definition of Moves 1.If δ (q, Z) = (p, Y, R), then   qZ  ⊦  Yp   If Z is the blank B, then also  q ⊦  Yp 2.If δ (q, Z) = (p, Y, L), then  For any X,  XqZ  ⊦  pXY   In addition, qZ  ⊦ pBY 

– 25 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Languages of a TM  A TM defines a language by final state, as usual.  L(M) = {w | q 0 w ⊦ *I, where I is an ID with a final state}.  Or, a TM can accept a language by halting.  H(M) = {w | q 0 w ⊦ *I, and there is no move possible from ID I}.

– 26 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Equivalence of Accepting and Halting 1.If L = L(M), then there is a TM M’ such that L = H(M’). 2.If L = H(M), then there is a TM M” such that L = L(M”).

– 27 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Proof of 1: Acceptance -> Halting  Modify M to become M’ as follows: 1. For each accepting state of M, remove any moves, so M’ halts in that state. 2. Avoid having M’ accidentally halt.  Introduce a new state s, which runs to the right forever; that is δ (s, X) = (s, X, R) for all symbols X.  If q is not accepting, and δ (q, X) is undefined, let δ (q, X) = (s, X, R).

– 28 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Proof of 2: Halting -> Acceptance  Modify M to become M” as follows: 1. Introduce a new state f, the only accepting state of M”. 2. f has no moves. 3. If δ (q, X) is undefined for any state q and symbol X, define it by δ (q, X) = (f, X, R).

– 29 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Recursively Enumerable Languages  We now see that the classes of languages defined by TM’s using final state and halting are the same.  This class of languages is called the recursively enumerable languages. Why? The term actually predates the Turing machine and refers to another notion of computation of functions.

– 30 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Recursive Languages  An algorithm is a TM that is guaranteed to halt whether or not it accepts.  If L = L(M) for some TM M that is an algorithm, we say L is a recursive language. Why? Again, don’t ask; it is a term with a history.

– 31 – CSCE 355 Summer 2015 ialc slides Ullman Stanford Example: Recursive Languages  Every CFL is a recursive language. Use the CYK algorithm.  Every regular language is a CFL (think of its DFA as a PDA that ignores its stack); therefore every regular language is recursive.  Almost anything you can think of is recursive.