Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Similar documents
Introduction to Turing Machines. Reading: Chapters 8 & 9

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

The Turing Machine. CSE 211 (Theory of Computation) The Turing Machine continued. Turing Machines

Chapter 3: The Church-Turing Thesis

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing Machines Part III

CSE 105 THEORY OF COMPUTATION

Most General computer?

CS21 Decidability and Tractability

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Theory of Computation (IX) Yijia Chen Fudan University

Turing Machines Part II

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

TURING MAHINES

CSCC63 Worksheet Turing Machines

CSci 311, Models of Computation Chapter 9 Turing Machines

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs)

CSE 105 THEORY OF COMPUTATION

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Further discussion of Turing machines

1 Showing Recognizability

CPSC 421: Tutorial #1

Automata Theory CS S-12 Turing Machine Modifications

Fundamentals of Computer Science

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

Deterministic Finite Automata (DFAs)

Decidability (What, stuff is unsolvable?)

Languages, regular languages, finite automata

Turing Machines. Wolfgang Schreiner

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

The decision problem (entscheidungsproblem), halting problem, & Turing machines. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CS4026 Formal Models of Computation

The Church-Turing Thesis

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Turing Machines (TM) The Turing machine is the ultimate model of computation.

IV. Turing Machine. Yuxi Fu. BASICS, Shanghai Jiao Tong University

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Busch Complexity Lectures: Turing s Thesis. Costas Busch - LSU 1

Introduction to Turing Machines

Theory of Computation

CSE 105 THEORY OF COMPUTATION

Chapter 8. Turing Machine (TMs)

CSCE 551 Final Exam, Spring 2004 Answer Key

Before We Start. Turing Machines. Languages. Now our picture looks like. Theory Hall of Fame. The Turing Machine. Any questions? The $64,000 Question

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Part I: Definitions and Properties

Fooling Sets and. Lecture 5

V Honors Theory of Computation

Nondeterministic Finite Automata

Lecture 13: Turing Machine

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CS20a: Turing Machines (Oct 29, 2002)

Theory of Computation

The Turing machine model of computation

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Turing Machines. Chapter 17

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Computability Theory. CS215, Lecture 6,

1 Unrestricted Computation

Theory of Computation Turing Machine and Pushdown Automata

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Theory of Computer Science

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

The tape of M. Figure 3: Simulation of a Turing machine with doubly infinite tape

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage.

September 7, Formal Definition of a Nondeterministic Finite Automaton

ASSIGNMENT THREE SOLUTIONS MATH 4805 / COMP 4805 / MATH (1) (a) A transition diagram appears below for the TM specified by the 7-tuple M =

Foundations of

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

HIS LEGACY. 100 Years Turing celebration. Gordana Dodig Crnkovic, IDT Open Seminar. Computer Science and Network Department Mälardalen University

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Lecture 14: Recursive Languages

Section 14.1 Computability then else

CSE 105 THEORY OF COMPUTATION

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Computability and Complexity Theory

(a) Definition of TMs. First Problem of URMs

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage?

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

Finite Automata. Mahesh Viswanathan

7.2 Turing Machines as Language Acceptors 7.3 Turing Machines that Compute Partial Functions

Closure under the Regular Operations

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Transcription:

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) 1

Deterministic Turing Machine (DTM).. B B 0 1 1 0 0 B B.. Finite Control Two-way, infinite tape, broken into cells, each containing one symbol. Two-way, read/write tape head. Finite control, i.e., a program, containing the position of the read head, current symbol being scanned, and the current state. An input string is placed on the tape, padded to the left and right infinitely with blanks, read/write head is positioned at the left end of input string. In one move, depending on the current state and symbol being scanned, the TM: changes state prints a symbol over the cell being scanned, and moves its tape head one cell left or right. 2

Formal Definition of a DTM A DTM is a seven-tuple: M = (Q, Σ, Γ, δ, q 0, B, F) Q Γ B Σ q 0 F δ A finite set of states A finite tape alphabet A distinguished blank symbol, which is in Γ A finite input alphabet, which is a subset of Γ {B} The initial/starting state, q 0 is in Q A set of final/accepting states, which is a subset of Q A next-move function, which is a mapping (i.e., may be undefined) form Q x Γ > Q x Γ x {L,R} Intuitively, δ(q,s) specifies the next state, symbol to be written, and the direction of tape head movement by M after reading symbol s while in state q. 3

Example #1: {w w is in {0,1}* and w ends with a 0} 0 00 10 10110 Not ε Q = {q 0, q 1, q 2 } Γ = {0, 1, B} Σ = {0, 1} F = {q 2 } δ: 0 1 B q 0 (q 0, 0, R) (q 0, 1, R) (q 1, B, L) q 1 (q 2, 0, R) - - q 2 - - - q 0 is the scan right state q 1 is the verify 0 state 4

Example #1: {w w is in {0,1}* and w ends with a 0} 0 1 B q 0 (q 0, 0, R) (q 0, 1, R) (q 1, B, L) q 1 (q 2, 0, R) - - q 2 - - - Sample Computation: (on 0010) q 0 0010 0q 0 010 00q 0 10 001q 0 0 0010q 0 001q 1 0 0010q 2 5

Example #2: {0 n 1 n n >= 1} 0 1 X Y B q 0 (q 1, X, R) - - (q 3, Y, R) - q 1 (q 1, 0, R) (q 2, Y, L) - (q 1, Y, R) - q 2 (q 2, 0, L) - (q 0, X, R) (q 2, Y, L) - q 3 - - - (q 3, Y, R) (q 4, B, R) q 4 - - - - - Sample Computation: (on 0011) q 0 0011 Xq 1 011 X0q 1 11 Xq 2 0Y1 q 2 X0Y1 Xq 0 0Y1 XXq 1 Y1 XXYq 1 1 XXq 2 YY Xq 2 XYY XXq 0 YY XXYq 3 Y XXYYq 3 XXYYBq 4 6

Example #2: {0 n 1 n n >= 1} 0 1 X Y B q 0 (q 1, X, R) - - (q 3, Y, R) - q 1 (q 1, 0, R) (q 2, Y, L) - (q 1, Y, R) - q 2 (q 2, 0, L) - (q 0, X, R) (q 2, Y, L) - q 3 - - - (q 3, Y, R) (q 4, B, R) q 4 - - - - - The TM basically matches up 0 s and 1 s q 0 is the check off a zero state q 1 is the scan right, find and check off a matching 1 state q 2 is the scan left state q 3 is the verify no more ones state q 4 is the final state Other Examples: 000111 00 11 001 011 010 110 7

Definition: Let M = (Q, Σ, Г, δ, q 0, B, F) be a TM. The language accepted by M, denoted L(M), is the set {w w is in Σ* and w is accepted by M} 8

What kinds of things can TMs do? Accept languages (as above) Simulate DFAs, NFAs and PDAs Compute functions and operators (+, *, etc) Have subroutines, pass parameters Simulate arbitrary computer programs Exercises: Construct a DTM for each of the following. {w w is in {0,1}* and w ends in 00} {w w is in {0,1}* and w contains at least 2 0 s} {w w is in {0,1}* and w contains at least one 0 and one 1} {w w is in {0,1}* and w contains at least one occurrence of the substring 00} A TM that adds 1 to a given binary number Suppose the input to a Turing machine consists of two n-bit binary numbers separated by a # character. Give a deterministic Turing machine that will determine if the first binary number is larger than the second. Note that the turning machine should output 1 to the right of the second number if the answer is yes, and a 0 if the answer is no. 9

Be Careful! Note that, just like a computer program, a TM can contain an infinite loop: 0 1 B q 0 (q 0, 0, R) (q 0, 1, R) (q 0, B, R) This is somewhat equivalent to: while (true) ; As with more general programs, more complicated TM infinite loops can occur. 10

TM Computations In summary, given an arbitrary Turing machine M, and a string x, there are three possible types of computations: M terminates in a final state, in which case we say x is accepted and in L(M). M terminates in a non-final state, in which case we say x is not accepted and is not in L(M). M goes into an infinite loop, in which case we say x is not accepted and is not in L(M). Stated another way, given an arbitrary Turing machine M, and a string x: If x is in L(M) then M will halt in a final state. If x is not in L(M) then M may enter an infinite loop, or halt in a non-final state. 11

TMs as a General Model of Computation Questions: How difficult would it be to simulate an arbitrary TM with a computer program? How difficult would it be to simulate an arbitrary computer program with a TM? TMs Model General Purpose Computers: If a TM can do it, so can a GP computer If a GP computer can do it, then so can a TM 12

More formally, this is codified in the Church-Turing Thesis: There is an effective procedure for solving a problem if and only if there is a TM that halts for all inputs and solves the problem. Informally, the notion of an effective procedure is intended to represent a program that a real, general purpose computer could execute: Finitely describable Well defined, discrete, mechanical steps Always terminates TMs formalize the above notion, i.e., the computing capability of a general purpose computer. Other models, such as DFAs and PDAs do not model all effective procedures or computable functions, but only a subset. 13

Modifications of the Basic TM Model There are many other computing models, but all are equivalent to or subsumed by TMs. There is no more powerful machine (Technically not proven). Other (Extended) TM Models: One-way infinite tapes Multiple tapes and tape heads Non-Deterministic TMs Multi-Dimensional TMs (n-dimensional tape) Multi-Heads Multiple tracks All of these extensions are equivalent to the basic TM model * *In terms of the languages accepted, but not necessarily in terms of performance. 14