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

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

CSci 311, Models of Computation Chapter 9 Turing Machines

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

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

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

Most General computer?

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

Turing Machines Part II

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

Chapter 3: The Church-Turing Thesis

Introduction to Turing Machines

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

1 Unrestricted Computation

Lecture 14: Recursive Languages

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

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

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

Computability Theory. CS215, Lecture 6,

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

Equivalent Variations of Turing Machines

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

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

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

Turing Machines. Lecture 8

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

Lecture 12: Mapping Reductions

Turing Machines. Wolfgang Schreiner

CS21 Decidability and Tractability

Theory of Computation - Module 4

Turing Machines Decidability

The Church-Turing Thesis

Turing Machines. Nicholas Geis. February 5, 2015

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

Theory of Computation

Chapter 8. Turing Machine (TMs)

Decidable Languages - relationship with other classes.

UNRESTRICTED GRAMMARS

CS20a: Turing Machines (Oct 29, 2002)

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

CSCE 551 Final Exam, Spring 2004 Answer Key

(a) Definition of TMs. First Problem of URMs

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

and Models of Computation

CS4026 Formal Models of Computation

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

CSCC63 Worksheet Turing Machines

Turing machine. Turing Machine Model. Turing Machines. 1. Turing Machines. Wolfgang Schreiner 2. Recognizing Languages

Fundamentals of Computer Science

Theory of Computation Turing Machine and Pushdown Automata

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

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

CSE 105 THEORY OF COMPUTATION

Part I: Definitions and Properties

ECS 120 Lesson 15 Turing Machines, Pt. 1

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Theory of Computation (IX) Yijia Chen Fudan University

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Designing 1-tape Deterministic Turing Machines

Turing Machines and the Church-Turing Thesis

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

TURING MAHINES

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CS20a: Turing Machines (Oct 29, 2002)

Turing machines and linear bounded automata

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

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

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

Chapter 7 Turing Machines

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

where Q is a finite set of states

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing machines and linear bounded automata

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

The Turing machine model of computation

Homework Assignment 6 Answers

Turing machines and linear bounded automata

X-machines - a computational model framework.

Lecture 13: Turing Machine

Turing Machines Part II

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

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

Reducability. Sipser, pages

UNIT 1 TURING MACHINE

Decidability: Church-Turing Thesis

7.1 The Origin of Computer Science

Decidability (What, stuff is unsolvable?)

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Lecture notes on Turing machines

The Power of One-State Turing Machines

CSE 460: Computabilty and Formal Languages Turing Machine (TM) S. Pramanik

Automata Theory CS S-12 Turing Machine Modifications

Foundations of

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

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Section 14.1 Computability then else

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

Transcription:

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

Alan Turing One of the first to conceive a machine that can run computation mechanically without human intervention. We call algorithmic computation now. The first to conceive a universal machine that can run programs Break German Enigma Machine (encryption) in WWII Turing Award: the most prestigious award in CS Bio movie: The Imitation Game, 2015 1912-1954 2

TM Model 3

Definition A Turing machine (TM) M is defined by M=(Q,,,, q 0,, F) Q: the set of internal states : the input alphabet : the tape alphabet : Q Q {L,R}, the transition function : blank symbol q 0 Q: the initial state F Q: the set of final states Note: this TM is deterministic. 4

(q 0, a)=(q 1, d, R) Transition function 5

Example: M=({q 0, q 1 }, {a,b}, {a, b, },, q 0,, {q 1 }) (q 0, a)=(q 0, b, R) (q 0, b)=(q 0, b, R) (q 0, )=(q 1,, L) 6

(q 0, a)=(q 0, b, R) (q 0, b)=(q 0, b, R) (q 0, )=(q 1,, L) Transition graph 7

TM runs forever Check TM on input aab 8

Instantaneous description x 1 qx 2 = a 1 a 2 a k-1 q a k a k+1 a n Also, called configuration 9

Example: M=({q 0, q 1 }, {a,b}, {a, b, },, q 0,, {q 1 }) (q 0, a)=(q 0, b, R) (q 0, b)=(q 0, b, R) (q 0, )=(q 1,, L) ID: q 0 aa, bq 0 a, bbq 0, bq 1 b Move: q 0 aa bq 0 a bbq 0 bq 1 b (halt) 10

TM halts A TM on input w halts if q 0 w reaches a configuration that is not defined. A TM on an input w may not halt. (Run forever) Halting configuration: x 1 qx 2 (halt) Halting does not imply acceptance Accepting configuration: x 1 q f x 2 (halt) Must halt and enter a final state q f Acceptance implies halting Infinite loop (non-stop): x 1 qx 2 * 11

A computation A computation is a sequence of configurations that leads to a halt state. q 0 aa bq 1 b bbq 1 bq 1 b (halt) 12

Standard TM It is deterministic. There is only one tape. The tape is unbounded in both directions. All other cells are filled with blanks. No output devices. The input is on the tape in the beginning. The left string on the tape can be viewed as output. 13

TM as Language acceptors Transducers 14

TM as language acceptors A string w is accepted by M if M on input w enters a final state and halts. Note: no need to read the entire input The language accepted by M L(M)={w + : q 0 w * x 1 q f x 2 (halt), q f F, x 1, x 2 * } x 1 q f x 2 (halt) is a halt configuration. A language accepted by some TM is called a recursively enumerable (r.e.) set. 15

Example: Design a TM to accept the strings of form 00* The transition function (q 0, 0)=(q 1, 0, R) (q 1, 0)=(q 1, 0, R) (q 1, )=(q 2,, R) F={q 2 } 16

Example: Design a TM to accept L={a n b n : n 1} Idea: Loop Mark leftmost a as x in the tape Move all the way right to mark b as y After marking all a s, move all the way right to find 17

Example, w=aabb Mark leftmost a as x in the tape (q 0, a)=(q 1, x, R) Move all the way right to mark b as y (q 1, a)=(q 1, a, R) (q 1, y)=(q 1, y, R) (q 1, b)=(q 2, y, L)... a a b b... 18

Move back to find leftmost a (q 2, y)=(q 2, y, L) (q 2, a)=(q 2, a, L) (q 2, x)=(q 0, x, R) Repeat until all a s are marked as x s... x a y b... 19

After marking all a s as x s, move all the way right to find (q 0, y)=(q 3, y, R) (q 3, y)=(q 3, y, R) (q 3, )=(q 4,, R) If b is encountered during the action of moving right, TM halts on a non-final state.... x x y y... 20

Example: Design a TM to accept L={w {a,b} + : n a (w)=n b (w)} Idea: Loop Pose at the beginning of the string Mark leftmost a as x in the tape Move all the way right to find the first b and mark it as After marking all symbols as X, enter the final state 21

TM as transducers To compute a function f(w)=w, where w, w are strings q 0 w * q f w (halt) A function f:d R is TM-computable if there is a TM M=(Q,,,, q 0,, F) such that q 0 w * q f f(w) (halt) for all w D We will show in the following that TM can compute complicated functions 22

Example: (integer adder) Given two positive integer x and y, compute x+y x and y are unary-represented Eg. X=3, w(x)=111 Input: w(x) 0 w(y) Output: w(x+y) 0 That is, q 0 w(x)0w(y) q f w(x+y)0 23

The transition function (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 3, 0, L) (q 3, 1)=(q 3, 1, L) (q 3, )=(q 4,, R) Run q 0 111011 24

Example: (string copier) Design a TM to compute q 0 w * q f ww, w=1 + Steps 1. Replace every 1 by x 2. Find the rightmost x and replace it with 1 3. Travel to the right end and create 1 (in replace of ) 4. Repeat 2 and 3 until there are no x s 25

Run q 0 11 26

Examples: (comparer) Design a TM to compute 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 27

Combining TM for complicated tasks Design a TM to compute f(x,y)=x+y if x y, and f(x,y)=0 if x<y 28

q C,0 w(x)0w(y) * q A,0 w(x)0w(y) if x y * q E,0 w(x)0w(y) if x<y q A,0 w(x)0w(y) * q A,f w(x+y)0 q E,0 w(x)0w(y) * q E,f 0 29

Example: (if-then-else) if a then q j else q k (q i, a)=(q j0, a, R), for q i Q (q j0, c)=(q j, c, L), for all c (q i, b)=(q k0, b, R) for b -{a} (q k0, c)=(q k, c, L), for all c 30

Example: (integer multiplier) Design a TM for q 0 w(x)0w(y) * q f w(xy) Steps Loop until x contains no more 1 s Find a 1 in x and replace it with another a Replace leftmost 0 by 0y Replace all a s with 1 s 31

32

Macroinstructions subprogram A calls B 33

Turing s Thesis Mechanical computation Computation without human intervention Turing Thesis: any computation that can be carried out by mechanical means can be carried out by some Turing machine. Also called Church-Turing Thesis 34

Reasoning: Anything that can be done by an existing digital computer can be done by a TM No one has yet been able to suggest a problem, solvable by algorithms, but cannot be solved by some TM Other models are proposed. But, they are no more powerful than TM s. Even quantum computers are no more powerful than TM s in terms of the power language acceptance 35

Algorithms An algorithm for a functin f:d R is a TM such that q 0 d * q f f(d) for all d D 36