1 Turing Machines Zeph Grunschlag. 2 Agenda Turing Machines Alan Turing Motivation Church-Turing Thesis Definitions Computation TM Configuration Recognizers.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

Simplifications of Context-Free Grammars
Variations of the Turing Machine
PDAs Accept Context-Free Languages
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 4 An Introduction to Finite Automata
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
Introduction to Turing Machines
Turing Machines Part 1:. 2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple.
Programming Language Concepts
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
CSCI 3130: Formal Languages and Automata Theory Tutorial 5
Chapter 11: Models of Computation
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.
Turing Machines.
PP Test Review Sections 6-1 to 6-6
Briana B. Morrison Adapted from William Collins
Bellwork Do the following problem on a ½ sheet of paper and turn in.
CS 6143 COMPUTER ARCHITECTURE II SPRING 2014 ACM Principles and Practice of Parallel Programming, PPoPP, 2006 Panel Presentations Parallel Processing is.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
1 Incomputable Languages Zeph Grunschlag. 2 Announcements HW Due Tuesday.
How to convert a left linear grammar to a right linear grammar
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Turing Machines Variants
Introduction to Computability Theory
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Finite-state Recognizers
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Essential Cell Biology
PSSA Preparation.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
The Pumping Lemma for CFL’s
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 13: Turing Machines.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Variants of Turing machines
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Based on Slides by Zeph Grunschlag from Columbia University www1.cs.columbia.edu/~zeph/3261/L14/L14.ppt Basic Computability Reading Material: J. Savage,
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Turing Machines Chapter Plan Turing Machines(TMs) – Alan Turing Church-Turing Thesis – Definitions Computation Configuration Recognizable vs. Decidable.
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
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
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.
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 ? ?
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Busch Complexity Lectures: Turing Machines
CS21 Decidability and Tractability
Turing Machines 2nd 2017 Lecture 9.
Turing Machines (At last!).
Chapter 3: The CHURCH-Turing thesis
فصل سوم The Church-Turing Thesis
ICS 353: Design and Analysis of Algorithms
ICS 353: Design and Analysis of Algorithms
CS21 Decidability and Tractability
Decidability and Tractability
Presentation transcript:

1 Turing Machines Zeph Grunschlag

2 Agenda Turing Machines Alan Turing Motivation Church-Turing Thesis Definitions Computation TM Configuration Recognizers vs. Deciders

3 Alan Turing Alan Turing was one of the founding fathers of CS. His computer model –the Turing Machine– was inspiration/premonition of the electronic computer that came two decades later Was instrumental in cracking the Nazi Enigma cryptosystem in WWII Invented the Turing Test used in AI Legacy: The Turing Award. Pre-eminent award in Theoretical CS

4 A Thinking Machine First Goal of Turings Machine: A model that can compute anything that a human can compute. Before invention of electronic computers the term computer actually referred to a person whos line of work is to calculate numerical quantities! As this is a philosophical endeavor, it cant really be proved. Turings Thesis: Any algorithm can be carried out by one of his machines

5 A Thinking Machine Second Goal of Turings Machine: A model thats so simple, that can actually prove interesting epistemological results. Eyed Hilberts 10 th problem, as well as a computational analog of Gödels Incompleteness Theorem in Logic. Philosophy notwithstanding, Turings programs for cracking the Enigma cryptosystem prove that he really was a true hacker! Turings machine is actually easily programmable, if you really get into it. Not practically useful, though…

6 A Thinking Machine Imagine a super-organized, obsessive- compulsive human computer. The computer wants to avoid mistakes so everything written down is completely specified one letter/number at a time. The computer follows a finite set of rules which are referred to every time another symbol is written down. Rules are such that at any given time, only one rule is active so no ambiguity can arise. Each rule activates another rule depending on what letter/number is currently read, EG:

7 A Thinking Machine EG Successor Program Sample Rules: If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT! Lets see how they are carried out on a piece of paper that contains the reverse binary representation of 47:

8 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

9 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

10 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

11 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

12 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

13 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

14 A Thinking Machine EG Successor Program So the successors output on was which is the reverse binary representation of 48. Similarly, the successor of 127 should be 128:

15 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

16 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

17 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

18 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

19 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

20 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

21 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

22 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

23 A Thinking Machine EG Successor Program If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read , write 1, HALT!

24 A Thinking Machine It was hard for the ancients to believe that any algorithm could be carried out on such a device. For us, its much easier to believe, especially if youve programmed in assembly! However, ancients did finally believe Turing when Churchs lambda-calculus paradigm (on which lisp programming is based) proved equivalent!

25 Turing Machines A Turing Machine (TM) is a device with a finite amount of read-only hard memory (states), and an unbounded 1 amount of read/write tape-memory. There is no separate input. Rather, the input is assumed to reside on the tape at the time when the TM starts running. Just as with Automata, TMs can either be input/output machines (compare with Finite State Transducers), or yes/no decision machines. Start with yes/no machines.

26 Comparison with Previous Models Device Separate Input? Read/Write Data Structure Deterministic by default? FA PDA TM

27 Comparison with Previous Models Device Separate Input? Read/Write Data Structure Deterministic by default? FAYesNoneYes PDA TM

28 Comparison with Previous Models Device Separate Input? Read/Write Data Structure Deterministic by default? FAYesNoneYes PDAYesLIFO StackNo TM

29 Comparison with Previous Models Device Separate Input? Read/Write Data Structure Deterministic by default? FAYesNoneYes PDAYesLIFO StackNo TMNo 1-way infinite tape. 1 cell access per step. Yes (but will also allow crashes)

30 Turing Machine Decision Machine Example First example (adding 1 bit to reverse binary string) was basically something that a Finite Transducer could have achieved (except when theres overflow). Lets give an example from next step up in language hierarchy. {bit-strings with same number of 0s as 1s} –a context free language:

31 Turing Machine Decision Machine Example This is a true Turing machine as: Tape is semi-infinite (indicated by torn cell): Input is prepared at beginning of tape No intrinsic way to detect left tape end similar to empty stack detection problem for PDAs similar trick used –introduce $ as the end symbol All rules must include a move direction (R/L) Situations that cant happen arent dealt with (technically under-deterministic)

32 Turing Machine Decision Machine Example {bit-strings with same number of 0s as 1s}: Pseudocode: while (there is a 0 and a 1) cross these out if (everything crossed out) accept else reject

33 TM Example Instructions Set 0.if read , go right (dummy move), ACCEPT if read 0, write $, go right, goto 1 // $ detects start of tape if read 1, write $, go right, goto 2 1. if read , go right, REJECT if read 0 or X, go right, repeat (= goto 1) // look for a 1 if read 1, write X, go left, goto 3 2.if read , go right, REJECT if read 1 or X, go right, repeat // look for a 0 if read 0, write X, go left, goto 3 3.if read $, go right, goto 4// look for start of tape else, go left, repeat 4.if read 0, write X, go right, goto 1// similar to step 0 if read 1, write X, go right, goto 2 if read X, go right, repeat if read , go right, ACCEPT

34 TM Example State Diagram These instructions can be expressed by a familiar looking flow diagram: 0 1 rej 0 $,R acc  R 2 1 $,R 0|X R 1|X R 3  R 0 X,L 1 X,L 0|1|X L 4 $ R X R 0 X,R 1 X,R  R

35 TM Transition Notation An edge from the state p to the state q labeled by … a b,D means if in state p and tape head reading a, replace a by b and move in the direction D, and into state q a D means if in state p and tape head reading a, dont change a and move in the direction D, and into state q a|b|…|z … means that given that the tape head is reading any of the pipe separated symbols, take same action on any of the symbols

36 TM Configuration Notation A TMs next action is completely determined by current state and symbol read, so can predict all of future actions if know: 1. current state 2. current tape contents 3. current position of TMs reading head Handy notation lists all of these in a single string. A symbol representing current state, is sandwiched between content of tape to left of head, and content of tape to right (including tape head). The part of tape which is blank ad-infinitum is ignored.

37 TM Configuration Notation For example Is denoted by: $xxx1q Reading rule 3

38 TM Example Crazy Web-Page The following link shows how the example machine accepts and how the tape configuration notation changes step by step.how the example machine accepts

39 TM Formal Definition Static Picture DEF: A Turing machine (TM) consists of a 7-tuple M = (Q,,,, q 0, q acc, q rej ). Q,, and q 0, are the same as for an FA. is the tape alphabet which necessarily contains the blank symbol , as well as the input alphabet. is as follows: Therefore given a non-halt state p, and a tape symbol x, p,x = (q,y,D) means that TM goes into state q, replaces x by y, and the tape head moves in direction D.

40 TM Dynamic Picture A string x is accepted by M if after being put on the tape with the Turing machine head set to the left-most position, and letting M run, M eventually enters the accept state. In this case w is an element of L(M) –the language accepted by M. We can formalize this notion as follows:

41 TM Formal Definition Dynamic Picture Suppose TMs configuration at time t is given by uapxv where p is the current state, ua is whats to the left of the head, x is whats being read, and v is whats to the right of the head. If p,x = (q,y,R) then write: uapxv uaypv With resulting configuration uaypv at time t+1. If, p,x = (q,y,L) instead, then write: uapxv upayv There are also two special cases: head is forging new ground –pad with the blank symbol  head is stuck at left end –by def. head stays put (only case) is read as yields

42 TM Formal Definition Dynamic Picture As with context free grammars, one can consider the reflexive, transitive closure * of. I.e. this is the relation between strings recursively defined by: if u = v then u * v if u v then u * v if u *v and v * w, then u *w * is read as computes to A string x is said to be accepted by M if the start configuration q 0 x computes to some accepting configuration y –i.e., a configuration containing q acc. The language accepted by M is the set of all accepted strings. I.e: L(M) = { x * | accepting config. y, q 0 x * y }

43 TM Acceptors vs. Deciders Three possibilities occur on a given input w : 1.The TM M eventually enters q acc and therefore halts and accepts. (w L(M) ) 2.The TM M eventually enters q rej or crashes somewhere. M rejects w. (w L(M) ) 3.Neither occurs! I.e., M never halts its computation and is caught up in an infinite loop, never reaching q acc or q rej. In this case w is neither accepted nor rejected. However, any string not explicitly accepted is considered to be outside the accepted language. (w L(M) )

44 TM Acceptors vs. Deciders Any Turing Machines is said to be a recognizer and recognizes L(M); if in addition, M never enters an infinite loop, M is called a decider and is said to decide L(M). Q: Is the above M an recognizer? A decider? What is L(M)? 0 1 rej acc 2  R 1 R 0 R 1 R 0 R 1 L

45 TM Acceptors vs. Deciders A: M is an recognizer but not a decider because 101 causes an infinite loop. L(M) = Q: Is L(M ) decidable ? 0 1 rej acc 2  R 1 R 0 R 1 R 0 R 1 L

46 TM Acceptors vs. Deciders A: Yes. All regular languages are decidable because can always convert a DFA into a TM without infinite loops.

47 Constructive Example Heres a document showing how modular design can help you write down a TM decider for {a n b n c n }. The example is non-context free.a TM decider for {a n b n c n }