Turing Machines. Nicholas Geis. February 5, 2015

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

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

CSCC63 Worksheet Turing Machines

Lecture 13: Turing Machine

Theory of Computation

Introduction to Turing Machines. Reading: Chapters 8 & 9

ECS 120 Lesson 15 Turing Machines, Pt. 1

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

where Q is a finite set of states

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

Most General computer?

CSCI3390-Assignment 2 Solutions

Lecture notes on Turing machines

CS4026 Formal Models of Computation

Turing Machines Part II

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

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

Turing Machines. Lecture 8

Part I: Definitions and Properties

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

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

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

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

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

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

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

Sample Project: Simulation of Turing Machines by Machines with only Two Tape Symbols

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

The Turing machine model of computation

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

Chapter 1 Review of Equations and Inequalities

CFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa.

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov

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

6.5.3 An NP-complete domino game

Chapter 3: The Church-Turing Thesis

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

2.6 Variations on Turing Machines

Theory of Computation

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

Computability Theory. CS215, Lecture 6,

Chapter 7 Turing Machines

The Church-Turing Thesis

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Automata Theory CS S-12 Turing Machine Modifications

Homework Assignment 6 Answers

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

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Turing Machines. Wolfgang Schreiner

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

Fundamentals of Computer Science

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

CS154, Lecture 10: Rice s Theorem, Oracle Machines

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

CSci 311, Models of Computation Chapter 9 Turing Machines

1 Unrestricted Computation

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Lecture 14: Recursive Languages

Turing Machine Variants. Sipser pages

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

CPSC 421: Tutorial #1

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

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits

(Refer Slide Time: 0:21)

Turing Machines Extensions

Theory of Computation

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

CS21 Decidability and Tractability

Variants of Turing Machine (intro)

M. Smith. 6 September 2016 / GSAC

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

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Formal Definition of Computation. August 28, 2013

Turing Machines, diagonalization, the halting problem, reducibility

1 More finite deterministic automata

ECS 120 Lesson 20 The Post Correspondence Problem

(a) Definition of TMs. First Problem of URMs

UNIT-VI PUSHDOWN AUTOMATA

Introduction to Algebra: The First Week

Theory of Computation - Module 4

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

CS 21 Decidability and Tractability Winter Solution Set 3

Chapter Five: Nondeterministic Finite Automata

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

Turing Machine Variants

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

CS20a: Turing Machines (Oct 29, 2002)

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

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Foundations of

Turing machine recap. Universal Turing Machines and Undecidability. Alphabet size doesn t matter. Robustness of TM

Further discussion of Turing machines

Finite Automata. Mahesh Viswanathan

CpSc 421 Homework 9 Solution

1 Two-Way Deterministic Finite Automata

Boolean circuits. Lecture Definitions

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Transcription:

Turing Machines Nicholas Geis February 5, 2015 Disclaimer: This portion of the notes does not talk about Cellular Automata or Dynamical Systems, it talks about turing machines, however this will lay the ground work for something else that I will write about in the coming weeks where we will look at Turing Completeness in the Game of Life 1. So with that, let s begin. Turing Machine The first question to ask is, what is a turing machine? I will start with a simple explanation of a turing machine first before I go into a more rigorous definition. A turing machine, in essence, is a mathematically model of a machine that mechanically operates on a tape. It has four main components: 1. Tape: An arbitrarily long 2 piece of tape with cells placed one right after another. Each cell contains a symbol from some given finite alphabet which will always contain a blank state. 2. Operating Head: Now this is the machine itself. It can read and write or rewrite data on the tape and it can move one cell at a time, either to the left or to the right, on the tape. 3. State Register: The machine needs to be in a state in order to know what to do. This part tells the machine what state it is in from the finitely many states available to it. 4. Table of Instructions: These are the instructions that the machine follows according to the state it is in and the value of the cell it reads. The state of the head and the cell it reads will tell the machine to do the following in this particular sequence: (a) Either erase or write a symbol (replacing a j with a j,1 ), and then (b) Move the head either to the left or the right 3, and then (c) Assume the same or a new state as prescribed. 1 We will not be doing this. Sorry for the disappointment. 2 Long here is an infinite length tape with only a finite length string of information thus that string is preceded an succeeded by an infinite length tape containing only blank cells. 3 Some newer concepts for Turing Machines include a neutral state where the head will not move at all. 1

For example, suppose the machine head is on a cell with a value 1. Its state is 23 4. If the head is in state 23 and it reads a 1, then it will change that 1 to a 0, move left, and then change its state to 17. Each step follows the instructions specified in the state and then updates and continues from there until we have our desired output. Now this is the very simple definition for one. With a loose understand of what the machine is now, lets give it a more rigorous definition. This definition goes as follows: a one tape Turing Machine can be formally defined as a 7-tuple 5, M = Q, Σ, Γ, δ, q 0, B, F where M is our machine and the elements go as follows: 1. Q: The finite set of states of the finite control. 2. Σ: The finite set of input symbols. 3. Γ: The complex set of tape symbols, Σ Γ. 4. δ: The transition function. The arguments of δ(q, X) are a state q and a tape symbol X. The value of δ(q, X), if it is defined, is a triple (p, Y, D) where: (a) p is the next state, in Q. (b) Y is the symbol, in Γ, written in the cell being scanned, replacing whatever symbol was there. (c) D is a direction, either L or R, and telling us the direction in which the head moves. 5. q 0 : The initial starting state, and q 0 Q. 6. B: The blank symbol. This symbol is in Γ but not in Σ. The blank appears initially in all but the finite number of initial cells that hold input symbols. 7. F : The set of final or accepting states, and F Q. In the previous example, we had a q 0 = 23. The transition function took the input δ(23, 1) and outputted (17, 0, L). From that we see that 23, 17 Q and that B, 0, 1 Γ, where B is our blank state. In the stated example, we never defined F and we did not define δ well either. We will go over a better example once I introduce a few more ideas and notations for Turing Machines. 4 23 is just an arbitrary number I chose. 5 An n-tuple is a sequence, or ordered list, of n elements. 2

Instantaneous Description Now you may be thinking that this is great and all, but how do we define an infinitely long tape with a finite portion of non-blank cells of information? The way to describe the initial tape is called an instantaneous description. Each instantaneous description (or ID) contains an infinitely long string of blank cells at the start and the end as previously stated. So to capture everything, we will start with the leftmost non-blank entry and end with rightmost non-blank entry. To describe the position of the head and the state of the head in this notation, we put the state, q i, to the left of the symbol it happens to be on. To show a transition between each update of the machine we will use a. For example, we have that Σ = {X 1, X 2,..., X n }, Q = {q, p}, q 0 = q, and δ(q, X i ) = (p, Y, L), where 1 < i < n. X 1 X 2... X i 1 qx i X i+1... X n X 1 X 2... px i 1 Y X i+1... X n. That is the notation for describing the strings of symbols on the tape. With this we can create a transition diagram for the machine. Transition Diagram A transition diagram is similar to the phase space we created for SDS in the first week of this class. Basically, it will be a visual representation of how each head state interacts with each cell value as it goes from the starting state, q 0, to the final state, F. A more formal definition of a transition diagram goes as follows: 1. It consists of a set of nodes corresponding to the states of the Turing Machine. 2. There is an arc from state q to state p with X\Y D, where X is the initial state of the cell, Y is the new state of the cell, and D is the direction the head moves and is pictorially represented with and. 3. We represent the starting state with start and an arrow entering that state. 4. And we denote the accepting states as double circles. The only information that one cannot directly read from a transition diagram is which are blank cells. In most cases, B will continue to represent that state when it is not stated. An example will definitely help anyone who is confused by this. I will take an example from Introduction to Automata Theory, Languages, and Computation by John Hopcroft, Rajeev Motwani, and Jeffrey Ullman 6. 6 This book proved to be incredibly helpful in understanding the machines and this paper is mostly written entirely out of it. Chapter 8 in particular is great for turing machines. If anyone has more questions, definitely check this book for the answer. You can find a free copy on the internet. 3

Example In this example we will be looking at a code starting with n 0 s and followed by n 1 s. And we will be changing those 0 s to X s and the 1 s to Y s. The process to do this goes as follows: 1. Start at the leftmost 0 and change it to an X. 2. Check the symbol to the right and if it is not a 1, keep moving to the right until you reach one. 3. Once you reach a 1, change it to a Y and then move back left until you hit an X. 4. Once you reach an X, keep it an X move right. If there is a 0, then change that 0 to an X and move right again. 5. Repeat steps 1-4 until all 0 s are X s and 1 s are Y s. That is the loose description of the process. However, we want to run this in a turing machine so it must follow the structure of the machine. We will start by defining all the components to the machine. 1. Q: {q 0, q 1, q 2, q 3, q 4 } 2. Σ: {0, 1} 3. Γ: {0, 1, X, Y, B} 4. δ: The transition function is described by the following table: State \ Symbol 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 - - - - - Remember that δ inputs both head state and the symbol in the cell it reads and outputs a new state and symbol and moves to either the left or right. 5. q 0 is the start state. 6. B is the blank symbol. 7. F : a 4 is the final or accepting state. That is each component of a turing machine and now lets look at what the transition diagram looks like for this particular example. It looks like this 4

This probably looks a bit complicated but it truly is not too bad. I will break it down step by step with an example code, lets say 0011. So for all transition diagrams we start at start. So we start at the leftmost symbol and we are in state q 0. The ID looks as follows q 0 0011. Now, we run one step. So the transition diagram says that if the head reads a 0 and is in q 0 it will change the symbol to an X, change to state q 1, and move right. That happens, so we get q 0 0011 Xq 1 011. We continue to follow the diagram and its instructions. So the next instruction is if the head is in state q 1 and it reads 0 then it keeps the zero and remains in the same state except it moves to the right. Thus it will look like Xq 1 011 X0q 1 11. We can continue to follow the instructions given from the transition diagram and it will eventually complete what we want it to do. This is the complete sequence it will go through q 0 0011 Xq 1 011 X0q 1 11 Xq 2 0Y 1 q 2 X0Y 1 Xq 0 0Y 1 XXq 1 Y 1 XXq 1 Y 1 XXY q 1 1 XXq 2 Y Y Xq 2 XY Y XXq 0 Y Y XXY q 3 Y XXY Y q 3 At that last point we reach a blank cell so then it will run it in one last time and then stop. So from our input of 0011 we get an output of XXY Y which is the output we wanted from the description above. 5

References [1] Hopcroft, John, Rajeev Motwani, and Jeffrey Ullman. Introduction to Automata Theory, Languages, and Computation. Stanford: Pearson Eduction, 2001. Web [2] http://en.wikipedia.org/wiki/turing_machine. Wikipedia, January 29, 2015. 6