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

Similar documents
CSci 311, Models of Computation Chapter 9 Turing Machines

Turing Machines. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

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

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

ECS 120 Lesson 15 Turing Machines, Pt. 1

Turing Machines Part II

Part I: Definitions and Properties

Theory of Computation - Module 4

Most General computer?

Chapter 8. Turing Machine (TMs)

Turing Machines. Nicholas Geis. February 5, 2015

where Q is a finite set of states

1 Unrestricted Computation

Introduction to Turing Machines

Automata Theory (2A) Young Won Lim 5/31/18

Fundamentals of Computer Science

Busch Complexity Lectures: Turing Machines. Prof. Busch - LSU 1

Chapter 2: Finite Automata

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

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

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

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

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

Automata Theory - Quiz II (Solutions)

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Chapter 7 Turing Machines

X-machines - a computational model framework.

Computation Histories

Non-emptiness Testing for TMs

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

Turing Machines Part III

CSCC63 Worksheet Turing Machines

Theory of Computation

Computability and Complexity

Lecture 14: Recursive Languages

The Power of One-State Turing Machines

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Chapter 6: Turing Machines

Homework 8. a b b a b a b. two-way, read/write

CpSc 421 Homework 9 Solution

Computability Theory. CS215, Lecture 6,

Lecture 13: Turing Machine

Introduction to Languages and Computation

Theory of Computation Turing Machine and Pushdown Automata

Turing Machines. Lecture 8

UNIT 1 TURING MACHINE

Lecture notes on Turing machines

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

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

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

Turing Machines. Wolfgang Schreiner

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

The Church-Turing Thesis

Turing Machines, diagonalization, the halting problem, reducibility

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

Introduction to Turing Machines. Reading: Chapters 8 & 9

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

CSE 105 THEORY OF COMPUTATION

CS21 Decidability and Tractability

CS4026 Formal Models of Computation

The Turing machine model of computation

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

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

A Note on Turing Machine Design

UNIT-VIII COMPUTABILITY THEORY

TWO-WAY FINITE AUTOMATA & PEBBLE AUTOMATA. Written by Liat Peterfreund

Introduction to Formal Languages, Automata and Computability p.1/42

Chapter 3: The Church-Turing Thesis

Equivalent Variations of Turing Machines

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

Confusion of Memory. Lawrence S. Moss. Department of Mathematics Indiana University Bloomington, IN USA February 14, 2008

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

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

CPSC 421: Tutorial #1

CSCE 551: Chin-Tser Huang. University of South Carolina

Finite Automata. Mahesh Viswanathan

CS20a: Turing Machines (Oct 29, 2002)

CSE 105 THEORY OF COMPUTATION

Theory of Computation

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

Turing Machines. Chapter 17

Theory of Computation

Post s Correspondence Problem (PCP) Is Undecidable. Presented By Bharath Bhushan Reddy Goulla

Turing Machines and the Church-Turing Thesis

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

Lecture 12: Mapping Reductions

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

1 Showing Recognizability

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

Solution Scoring: SD Reg exp.: a(a

Reducability. Sipser, pages

(a) Definition of TMs. First Problem of URMs

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

Complexity Theory Turing Machines


V Honors Theory of Computation

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

arxiv: v1 [cs.cc] 3 Feb 2019

Nondeterministic Finite Automata

Transcription:

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage? What is the most powerful of automata? In this lecture we will introduce the Turing machine, a simple mathematical model of a computer. Despite its simplicity, the Turing machine is equivalent in computing power to the digital computer as we know it today.

The Turing machine model A formal model for an effective procedure should possess certain properties. 1. Each procedure should be finitely describable. 2. The procedure should consist of discrete steps, each of which can be carried out mechanically. Such a model was introduced by Alan Turing in 1936.

Turing machine A Turing machine (TM) is an automaton whose storage is a tape. This tape is divided into cells, each of which is capable of holding one symbol. It has a read-write head that can travel right or left and that can read and write a single symbol on each move. The TM has neither an input file nor any special output mechanism. Whatever input and output is necessary will be done on the machine s tape. Read-write head Control unit Tape

Turing machine Definition A Turing machine M is defined by M = (Q, Σ, Γ, δ, q 0,, F ), where Q is the set of states, Σ is the input alphabet, Γ is a finite set of symbols called the tape alphabet, δ is the transition function defined as δ : Q Γ Q Γ {L, R}, (the move symbols L, R indicate whether the read-write head moves left or right one cell after the new symbol has been written on the tape.) Γ is a special symbol called the blank, q 0 Q is the inital state, F Q is the set of final states. We assume that Σ Γ \ { }.

Turing machine The automaton starts in the given initial state with some information on the tape. It then goes through a sequence of steps controlled by δ. The contents of any cell on the tape may be examined and changed many times. Eventually the whole process may terminate, which is achieved by putting the TM into a halt state. A TM is said to halt whenever it reaches a configuration for which δ is not defined. We assume that no transitions are defined for any final state, so the TM will halt whenever it enters a final state.

Turing machine Example 1:

Turing machine Example 2:

Turing machine Summarizing the main features of our TM model: 1. The TM has a tape that is unbounded in both directions, allowing any number of left and right moves. 2. The TM is deterministic in the sense that δ defines at most one move for each configuration. 3. There is no special input file. We assume that at the inital time the tape has some specified content. 4. Similarly, there is no special output device. Whenever the machine halts, some or all of the contents of the tape may be viewed as output.

Turing machine The most convenient way to exhibit a sequence of configurations of a TM uses the idea of an instantaneous description. Any configuration is completely determined by the current state, the contents of the tape, and the position of the read-write head. We use the notation in which x 1 qx 2 or a 1 a 2... a k 1 qa k a k+1... a n is the instantaneous description of a machine in state q (scanning a k ).

Turing machine The instantaneous description gives only a finite amount of information to the right and left of the read-write head. The unspecified part of the tape is assumed to contain all blanks. If the position of blanks is relevant, the blank symbol may appear in the instantaneous description.

Turing machine A move from one configuration to another will be denoted by. If δ(q 1, c) = (q 2, e, R), then the move abq 1 cd abeq 2 d is made whenever the internal state is q 1, the tape contains abcd, and the read-write head is on the c. The symbol has the usual meaning of an arbitrary number of moves. We use M to distinguish between several machines.

Turing machine Definition Let M = (Q, Σ, Γ, δ, q 0,, F ) be a TM. Then any string a 1... a k 1 q 1 a k a k+1... a n, with a i Γ and q 1 Q is an instantaneous description of M. A move a 1... a k 1 q 1 a k a k+1... a n a 1... a k 1 bq 2 a k+1... a n is possible iff δ(q 1, a k ) = (q 2, b, R). A move a 1... a k 1 q 1 a k a k+1... a n a 1... q 2 a k 1 ba k+1... a n is possible iff δ(q 1, a k ) = (q 2, b, L).

Turing machine Definition (continued) M is said to halt starting from some inital configuration if x 1 q i x 2 x 1 q i x 2 y1 q j ay 2 for any q j and a, for which δ(q j, a) is undefined. The sequence of configurations leading to a halt state will be called a computation. If, from the initial configuration x 1 qx 2, the machine goes into a loop and never halts, then we write x 1 qx 2.

Turing machines as language acceptors A string w is written on the tape, with blanks filling out the unused portions. The machine is started in the initial state q 0 with the read-write head positioned on the leftmost symbol of w. If, after a sequence of moves, the TM enters a final state and halts, then w is considered to be accepted.

Turing machines as language acceptors Definition Let M = (Q, Σ, Γ, δ, q 0,, F ) be a Turing machine. The language accepted by M is L(M) = {w Σ + q 0 w x 1 q f x 2 for some q f F, x 1, x 2 Γ }. This definition tells us that the machine will halt when w L(M). When w is not in L(M) then the machine can halt in a non-final state or it can enter an infinite loop and never halt.

Turing machines as language acceptors Example: For Σ = {a, b}, we design a TM that accepts L = {a n b n n 1}. Intuitively, the problem is solved in the following fashion: Starting at the leftmost a we check it off by replacing it with some x aaabbb xaabbb We travel to the right to find the leftmost b, which we check off by replacing it with y. xaaybb We go left again to the leftmost a xaaybb Traveling back and forth we match each a with a corresponding b.

Turing machines as transducers Turing machines are not only interesting as language acceptors, they also provide us with a simple abstract model for digital computers. The primary purpose of a computer is to transform input to output, it acts as a transducer. Modeling computers using Turing machines The input for a computation will be all the nonblank symbols on the tape at the initial time. At the conclusion of the computation, the output will be whatever is then on the tape. Thus, we can view a TM transducer M as an implementation of a function f defined by ŵ = f(w), provided that q 0 w q f ŵ, for some final state q f.

Turing machines as transducers Definition A function f with domain D is said to be Turingcomputable or just computable if there exists some TM M = (Q, Σ, Γ, δ, q 0,, F ) such that q f F, for all w D. q 0 w q f f(w), All the common mathematical functions, no matter how complicated, are Turing-computable.

Turing machines as transducers Example: Given two positive integers x and y, we design a TM that computes x + y. We use unary notation to represent positive integers. Any positive integer x is represented by w(x) = {1} +, such that w(x) = x. Initially w(x) and w(y) are on the tape in unary notation, seperated by a single 0, with the read-write head on the leftmost symbol of w(x). After computation, w(x + y) in on the tape followed by a single 0, and the read-write head positioned at the left end of the result.

Turing machines as transducers Example (continued): We want to design a TM for performing the computation where q f is a final state. q 0 w(x)0w(y) q f w(x + y)0, All we need to do is to move the seperating 0 to the right end of w(y), so that the addition amounts to nothing more than the concatenation of the two strings. Unary notation for practical computations is cumbersome, but very convenient for programming Turing machines. The resulting programs are much shorter and simpler than binary or decimal representations.

Turing machines as transducers Adding numbers is one of the fundamental operations of any computer, one that plays a part in the synthesis of more complicated instructions. Other basic operations are copying strings and simple comparisons. These can also be done easily on a Turing machine.

Turing machines as transducers Example: Let x and y be two positive integers represented in unary notation. We construct a Turing machine that will halt in a final state q y if x y and that will halt in a non-final state q n if x < y. More precisely, the machine is to perform the computation q 0 w(x)0w(y) q y w(x)0w(y) if x y, q 0 w(x)0w(y) q n w(x)0w(y) if x < y. Instead of matching a s and b s, we match each 1 on the left of the dividing 0 with the 1 on the right.

Turing machines as transducers Example (continued): At the end of the matching, we will have on the tape either xx... 110xx... x or xx... xx0xx... x11, depending on whether x > y or y > x. In the first case, when we attempt to match another 1, we encounter the blank at the right of the working space. This can be used as a signal to enter the state q y (halt in final state). In the second case, we still find a 1 on the right when all 1 s on the left have been replaced. We use this to get into the state q n (halt in non-final state). This example makes the important point that a TM can be programmed to make decisions based on arithmetic comparisons.

Combining TM s for complicated tasks We have shown explicitly how some important operations found in all computers can be done on a TM. Since, in digital computers, such primitive operations are the building blocks for more complex instructions, let us see how these basic operations can also be put together on a TM. We can describe TM s in several ways at a high level, namely either with pseudo code or block diagrams. In a block diagram, we encapsulate computations in boxes whose function is described, but whose interior details are not shown. By using such boxes, we implicitly claim that they can actually be constructed.

Combining TM s for complicated tasks Example: Designing a TM that computes the function f(x, y) = x + y if x y, = 0 if x < y. We first use a comparing machine to determine whether or not x y. If so, the comparer sends a start signal to the adder which then computes x + y. If not, the eraser is started and changes every 1 to a blank.

Combining TM s for complicated tasks Example (continued): The computations to be done by the Comparer C are q C,0 w(x)0w(y) q A,0 w(x)0w(y) if x y, q C,0 w(x)0w(y) q E,0 w(x)0w(y) if x < y. Computations performed by the adder A q A,0 w(x)0w(y) q A,f w(x + y)0 Computations performed by the eraser E q E,0 w(x)0w(y) q E,f 0 The result is a single TM that combines the action of C, A, and E.

References LINZ, P. An introduction to Formal Languages and Automata. Jones and Bartlett Learning, 2012. HOPCROFT, J. and ULLMAN, J. Introduction to Automata Theory, Languages and Computation. Addison-Wesley, 1979.