CS 3240 – Chapter 9.  Turing Machines  From Alan Turing, 1936  Turns out to be the LAST machine  The only machine you'll ever need  The Church-Turing.

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
Variants of Turing machines
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
Lecture 5 Turing Machines
Courtesy Costas Busch - RPI1 Turing Machines. Courtesy Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Computation Theory Introduction to Turing Machine.
Turing Machines.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
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.
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.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
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
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
1 Turing Machines There are languages that are not context-free. What can we say about the most powerful automata and the limits of computation?. Alan.
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
CS 3240 – Chapter 11.  They may not halt on every possible input!  And not just because the creator of a specific TM was a doofus  This is related.
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)
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,
CS 3240 – Chapters.  PDAs with 2 stacks or 1 queue  TMs with 1-way infinite tape  TMs with n tapes or n heads or n-dim tapes  TMs with various “move”
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.
1 Turing machines Chapter 4, Smith and Kimber. A Turing machine is an abstraction of a human “computer”. Consists of - control, in the form of states -
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 IDT Open Seminar ALAN TURING AND HIS LEGACY 100 Years Turing celebration Gordana Dodig Crnkovic, Computer Science and Network Department Mälardalen University.
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.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
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.
CS 154 Formal Languages and Computability April 12 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
Turing Machines. The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Theory of Computation Automata Theory Dr. Ayman Srour.
CS 154 Formal Languages and Computability April 7 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Busch Complexity Lectures: Turing Machines
Turing Machines Chapter 17.
Pumping Lemma Revisited
Turing Machines 2nd 2017 Lecture 9.
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
Chapter 3: The CHURCH-Turing thesis
CS21 Decidability and Tractability
Decidability and Tractability
Variants of Turing machines
Presentation transcript:

CS 3240 – Chapter 9

 Turing Machines  From Alan Turing, 1936  Turns out to be the LAST machine  The only machine you'll ever need  The Church-Turing Thesis  All algorithms have a Turing Machine equivalent ▪ Some TMs are not algorithms, however 6/13/20162CS Chapter 9

 We have shown that a n b n c n is not context free  By the Pumping Lemma  What if we add an extra stack to a PDA? 6/13/20163CS Chapter 9

input, pop1/pop2, push1/push2 6/13/20164CS Chapter 9

 a n is accepted by an FA  a n b n is accepted by a PDA  a n b n c n is accepted by a 2PDA  What about a n b n c n d n ? 6/13/20165CS Chapter 9

6/13/20166CS Chapter 9

 An FA is a machine with no auxiliary memory  A PDA is like an FA but with unlimited, restricted memory  LIFO access  A Turing Machine is like an FA but with unlimited, unrestricted memory  We can move to any memory cell  We can both read and write there 6/13/20167CS Chapter 9

LanguageMachineGrammar RegularFinite AutomatonRegular Expression, Regular Grammar Context-FreePushdown AutomatonContext-Free Grammar Recursively Enumerable Turing MachineUnrestricted Phrase- Structure Grammar 8CS Introduction

6/13/20169CS Chapter 9

6/13/201610CS Chapter 9

 Control Unit (Deterministic)  states (1 start state; 1 or more or halt states)  transitions: input,output,move (L or R)  I/O Tape (2-way, infinite)  pre-populated with (finite) input  output left on tape after processing  special blank symbol ☐ ▪ not part of input alphabet ▪ used as a separator and/or a boundary 6/13/201611CS Chapter 9

 Contents left on tape is ignored  Typically has only one accepting state  with no out-edges  Any string that causes the TM to halt in an accepting state is in the TM’s language  otherwise it is not in the language  (an explicit reject state may also be used) 6/13/201612CS Chapter 9

 Pseudocode:  Replace the first a with an X  Move right to first b, replace with Y  Move to right first c, replace with Z  Move left to right-most X  Repeat the above for steps until no more a’s  When no more a’s, skip over all Y’s and Z’s  fail if anything other than a Y or Z is encountered  Halt and accept or reject 6/13/201613CS Chapter 9

aabbcc Xabbcc XaYbcc XaYbZc XXYbZc XXYYZc XXYYZZ XXYYZZ ☐ XXYYZZ ☐☐ (accept) 6/13/201614CS Chapter 9

6/13/201615CS Chapter 9 Trace aabbcc

(q 0 )aabbcc X(q 1 )abbcc Xa(q 1 )bbcc XaY(q 2 )bcc XaYb(q 2 )cc XaY(q 3 )bZc Xa(q 3 )YbZc X(q 3 )aYbZc (q 3 )XaYbZc X(q 0 )aYbZc XX(q 1 )YbZc XXY(q 1 )bZc XXYY(q 2 )Zc XXYYZ(q 2 )c XXYY(q 3 )ZZ XXY(q 3 )YZZ XX(q 3 )YYZZ X(q 3 )XYYZZ XX(q 0 )YYZZ XXY(q 4 )YZZ XXYY(q 4 )ZZ XXYYZ(q 4 )Z XXYYZZ(q 4 ) ☐ XXYYZZ ☐ (q 5 ) ☐ (accept) 6/13/201616CS Chapter 9

 A sequence of configurations in a TM leading to a halt state  i.e., it doesn’t crash  If the TM is an acceptor, it explicitly accepts  If the TM represents some function, f, it leaves f(x) on the tape, for each valid input x 6/13/2016CS Chapter 917

6/13/2016CS Chapter 918

 What would be a reasonable strategy? 6/13/2016CS Chapter 919

6/13/2016CS Chapter 920

 Suppose f: D → R is a function from domain D to range R  If there is a TM that transforms every d in D to f(d)  That is, it reads d from the tape, does its work, halts, and leaves f(d) on the tape…  Then f is Turing-computable  This is the formal definition of an algorithm 6/13/201621CS Chapter 9

 Must first decide how to encode numbers on a TM tape  Then we must separate the numbers, so we can distinguish between them  Plan:  represent the numbers in unary notation  then move the 1’s from one number to the other! ▪ i.e., just remove the separator, moving the 1’s together ▪ we’ll use zero as a separator ▪ see next slide… 6/13/201622CS Chapter 9

_ _ 6/13/201623CS Chapter 9

6/13/201624CS Chapter 9

 Using unary notation, as usual 6/13/2016CS Chapter 925

6/13/201626CS Chapter 9

6/13/201627CS Chapter 9 Trace ababb

 TMs typically have one start and one or two halt states (but can have many):  one if the TM is a function  two if the TM is an acceptor  You can “call” a TM as a routine by setting up appropriate “linkage”  return to the desired state in the calling machine  make sure the tape workspace is in an acceptable configuration for your instructions 6/13/201628CS Chapter 9

 Tape configuration:  start: [x]0[y]0  finish: [x]0[y]0[xy]  First, modify copy to accommodate a 0-delimiters:  0[y]0… → 0[y]0…[y]  and finish by positioning at left of y  Then, mark a 1 in x with a, copy y to end, and repeat; then restore x’s a’s to 1’s 6/13/201629CS Chapter 9

6/13/201630CS Chapter 9

6/13/2016CS Chapter 931

See Example 9.11 for an explanation of Comparer. See xplusyTM.py 6/13/201632CS Chapter 9

 T = (Q, ∑, Γ, δ, q 0, H)  Q = set of states  ∑ = input alphabet  Γ = tape alphabet  includes ∑ and blank symbol ( ☐ )  q 0 = start state  H = one or more halt states  no out-arrows  each typically represents a different meaning ▪ e.g., final vs. non-final 6/13/2016CS Chapter 933

6/13/2016CS Chapter 934 δ(q 0,1) = (q 0,1,R) δ(q 0,0) = (q 1,1,R) δ(q 1,1) = (q 1,1,R) δ(q 1, ☐ ) = (q 2, ☐,L) δ(q 2,1) = (q h, ☐,R)

δ ☐ 01 q0q0 (q 1,1,R)(q 0,1,R) q1q1 (q 2, ☐,L) (q 1,1,R) q2q2 (q h, ☐,R) 6/13/2016CS Chapter 935 δ(q 0,1) = (q 0,1,R) δ(q 0,0) = (q 1,1,R) δ(q 1,1) = (q 1,1,R) δ(q 1, ☐ ) = (q 2, ☐,L) δ(q 2,1) = (q h, ☐,R)

 q 0,1,q 0,1,R  q 0,0,q 1,1,R  q 1,1,q 1,1,R  q 1,_,q 2,_,L  q 2,1,q h,_,R  (_ = ☐ ; Use in Program 4) 6/13/2016CS Chapter 936

 Input:  A TM ▪ start state ▪ halt states ▪ quintuple format: state1,input,state2,output,direction  An input string (initial tape contents)  Output:  A trace of the actions of the machine ▪ with the current state positioned at the read-write head  Final state and tape contents 6/13/2016CS Chapter 937

 TMs can make multiple passes over the data  in multiple directions  And can process an arbitrary amount of auxiliary data in addition to the original input  They can give more meaningful output  vs. just yes/no  Interesting fact:  TMs came first! 6/13/2016CS Chapter 938

 TMs suffer from a vulnerability that FAs and PDAs do not:  They are not guaranteed to halt  They may hang (loop forever)!  Depends on the nature of the computation  More on this later 6/13/2016CS Chapter 939

 “Any computation that can be carried out by mechanical means can be performed by some TM”  Anything that can be done on any digital computer can be done by a TM  it’s the “lowest-level” programming language  No one has yet found a solvable problem for which a TM cannot be written  No alternative computation model invented is more powerful then a TM 6/13/201640CS Chapter 9

 The Turing Machine is the model for most programming as we know it  Imperative Programming  Defines a machine architecture  Characterized by reading and writing memory  Instructions and data share the same memory  There are other models of computation  Lambda Calculus (Functional paradigm; CS 4450)  Post Systems, Markov Systems, Structured Prog… 6/13/2016CS Chapter 941