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

Similar documents
Turing Machines Part II

Turing Machines Part II

Turing Machines Part III

A Note on Turing Machine Design

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

Turing Machines Part One

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

Decidability and Undecidability

CSE 105 THEORY OF COMPUTATION

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

Turing Machines Part Two

Complexity Theory Part I

Announcements. Using a 72-hour extension, due Monday at 11:30AM.

CSE 105 THEORY OF COMPUTATION

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

Week 2: Defining Computation

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

Part I: Definitions and Properties

Theory of Computation

CSE 105 THEORY OF COMPUTATION

Most General computer?

CS 525 Proof of Theorems 3.13 and 3.15

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CS4026 Formal Models of Computation

CS20a: Turing Machines (Oct 29, 2002)

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Turing Machines. Lecture 8

Complexity Theory Part I

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

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

Computability and Complexity

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Introduction to Languages and Computation

V Honors Theory of Computation

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

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

Pumping Lemma for CFLs

CPSC 421: Tutorial #1

The Church-Turing Thesis

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

Chapter 7 Turing Machines

Homework Assignment 6 Answers

SCHEME FOR INTERNAL ASSESSMENT TEST 3

CS 154 Introduction to Automata and Complexity Theory

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

Turing Machine Variants

CSE 105 THEORY OF COMPUTATION

CSCC63 Worksheet Turing Machines

Lecture 14: Recursive Languages

Computability Theory. CS215, Lecture 6,

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

MTAT Complexity Theory October 13th-14th, Lecture 6

The Turing machine model of computation

CS21 Decidability and Tractability

UNIT-VIII COMPUTABILITY THEORY

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

CSE 105 Theory of Computation

CSE 105 Theory of Computation

Computer Sciences Department

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

Announcements. Final exam review session tomorrow in Gates 104 from 2:15PM 4:15PM Final Friday Four Square of the quarter!

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

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

Turing machines and linear bounded automata

Turing Machines. Chapter 17

CSCI3390-Lecture 14: The class NP

CS20a: Turing Machines (Oct 29, 2002)

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

Chapter 8. Turing Machine (TMs)

1 Unrestricted Computation

MA/CSSE 474 Theory of Computation

Advanced topic: Space complexity

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

Non-emptiness Testing for TMs

3 Probabilistic Turing Machines

Turing Machines Part Three

ECS 120 Lesson 15 Turing Machines, Pt. 1

1 Deterministic Turing Machines

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

Please give details of your answer. A direct answer without explanation is not counted.

CSC236 Week 11. Larry Zhang

Cliff s notes for equivalence of CFLs and L(PDAs) LisaCFL L = L(M) for some PDA M L=L(M)forsomePDAM L = L(G) for some CFG G

Notes for Comp 497 (Comp 454) Week 12 4/19/05. Today we look at some variations on machines we have already seen. Chapter 21

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

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

Finite Automata Part Two

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

CpSc 421 Homework 9 Solution

Automata Theory CS S-12 Turing Machine Modifications

Lecture 3: Reductions and Completeness

Finite Automata (contd)

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

Lecture 12: Mapping Reductions

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

CSE 105 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing Machine Recap

Transcription:

Turing Machines

Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing machine machine would would be be built built and and how how the the machine machine works. works. I've I've tried tried to to condense condense the the slides slides here, here, but but I think think a lot lot got got lost lost in in the the conversion. I would would recommend reviewing reviewing the the full full slide slide deck deck to to walk walk through through each each animation animation and and see see how how the the overall overall constructions work. work. Hope Hope this this helps! helps! -Keith -Keith

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

Are some problems inherently harder than others?

Regular Languages DCFLs CFLs Languages recognizable by any feasible computing machine All Languages

That same drawing, to scale. All Languages

Defining Computability To talk about any feasible computing machine, we'll need a formal model of computation. The standard automaton for this job is the Turing machine, named after Alan Turing, the Father of Computer Science.

A Better Memory Device A Turing machine is a finite automaton equipped with an infinite tape as its memory. The tape begins with the input to the machine written on it, surrounded by infinitely many blank cells. The machine has a tape head that can read and write a single memory cell at a time. 0 0 1

The Turing Machine A Turing machine consists of three parts: A finite-state control that issues commands, an infinite tape for input and scratch space, and a tape head that can read and write a single tape cell. At each step, the Turing machine Writes a symbol to the tape cell under the tape head, changes state, and moves the tape head to the left or to the right.

Input and Tape Alphabets A Turing machine has two alphabets: An input alphabet Σ. All input strings are written in the input alphabet. A tape alphabet Γ, where Σ Γ. The tape alphabet contains all symbols that can be written onto the tape. The tape alphabet Γ can contain any number of symbols, but always contains at least one blank symbol, denoted. You are guaranteed Σ. At startup, the Turing machine begins with an infinite tape of symbols with the input written at some location. The tape head is at the start of the input.

A Simple Turing Machine start, R q acc q 0 1, R q 1 This This special special accept accept state state causes causes the the machine machine to to immediately immediately accept. accept. Each Each transition transition of of the the form form x y, y, D means means upon upon reading reading x, x, replace replace it it with with symbol symbol y and and move move the the tape tape head head in in direction direction D (which (which is is either either L or or R). R). The The symbol symbol represents represents the the blank blank symbol. symbol. 1, R q rej, R This This special special reject reject state state causes causes the the machine machine to to immediately immediately reject. reject.

Designing Turing Machines Despite their simplicity, Turing machines are very powerful computing devices. Today's lecture explores how to design Turing machines for various languages.

Designing Turing Machines Let Σ = {0, 1} and consider the language L = {0 n 1 n n N }. We know that L is context-free. How might we build a Turing machine for it?

L = {0 n 1 n n N } 0 0 0 1 1 1 0 1 0 1 1 0 0

A Recursive Approach The string ε is in L. The string 0w1 is in L iff w is in L. Any string starting with 1 is not in L. Any string ending with 0 is not in L.

, R 0 0, R 0 0, L 1 1, L Go to start 1, L Clear a 1 start, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

Multiplication Let Σ = {1,, =} and consider the language L = { 1 m 1 n =1 mn m, n N } This language is not regular (use the pumping lemma). This language is not context-free (use the pumping lemma). Can we build a TM for it?

Things To Watch For The input has to have the right format. Don't allow 11== 11, etc. The input must do the multiplication correctly. Don't allow 11 11=11111, for example. How do we handle this?

Key Idea: Subroutines A subroutine of a Turing machine is a small set of states in the TM such that performs a small computation. Usually, a single entry state and a single exit state. Many very complicated tasks can be performed by TMs by breaking those tasks into smaller subroutines.

L = {1 m 1 n =1 mn m, n N } start Check that the input is structured properly Check that the multiplication is correct.

Validating the Input We'll check that the input has the form 1 * 1 * =1 *. Just checking relative ordering of symbols, not the quantity of the symbols. How might we do this?

Checking for 1 * 1 * =1 * start 1 1, R 1 1, R 1 1, R 1 1, L, L = =, L Before Check for 0, R After = =, R After =, L Go to Start start = =, R, R, R, R = =, R, R, R q rej end

Multiplication Via TMs Now that we can check that the input is valid, how do we confirm the math is right? Idea: Use a recursive formulation of multiplication! If m = 0, then m n = 0. If m > 0, then m n = n + (m 1) n. Our algorithm: Given 1m 1 n =1 p : If m = 0, accept iff p = 0. Otherwise, accept iff 1 m-1 1 n =1 p-n is accepted.

Schematically Reject NO Is p = 0? YES Accept YES Start! Is m = 0? NO Set m = m 1 Set mn = mn n

1 1, L 1 1, L Start over, L Clear Marks, R 1 1, R = =, L 1 1, R = =, R start Cross off 1 1, R Go to, R Find a 1 1, R 1 Go to End, R, R 1 1, R, L End of Routine Go to 1, L Cross off 1 = =, R q rej 1 1, L = =, L 1 1, L

The Final Piece If m = 0, we need to check that p = 0. Input has form 1n =1 p. In other words, accept iff string matches the regular expression 1 * =. Exercise: Build a TM to check this!

Turing Machines and Math Turing machines are capable of performing Addition Subtraction Multiplication Integer division Exponentiation Integer logarithms Plus a whole lot more...

List Processing Suppose we have a list of strings represented as w 1 : w 2 : : w n : What sorts of transformations can we perform on this list using a Turing machine?

Example: Take Odds Given a list of 2n strings w 1 : w 2 : : w 2n : filter the list to get back just the odd-numbered entries: w 1 : w 3 : : w 2n 1 : How might we do this with a Turing machine?

start Read Symbol 0, R Go to end 0 0, R 1 1, R : :, R, R 0 0, R 1 1, R : :, R Find open, R spot 0, L Back to start Back to List 0 0, L 1 1, L : 1, L, L 0 0, L 1 1, L : 1, L, R Done! 1, R Go to end 0 0, R 1 1, R : :, R, R 0 0, R 1 1, R : :, R Find open spot 1, L 0, R 1, R :, R Clear next :, R 0 0, R 1 1, R : :, R Go to end, R 0 0, R 1 1, R : :, R Find open spot :, L

start Read Symbol 0, R Go to end 0 0, R 1 1, R : :, R, R 0 0, R 1 1, R : :, R Find open, R spot 0, L Back to start Back to List 0 0, L 1 1, L : 1, L, L 0 0, L 1 1, L : 1, L, R Done! 1, R Go to end 0 0, R 1 1, R : :, R, R 0 0, R 1 1, R : :, R Find open spot 1, L 0, R 1, R :, R Clear next :, R 0 0, R 1 1, R : :, R Go to end, R 0 0, R 1 1, R : :, R Find open spot :, L

Turing Machine Memory Turing machines often contain many seemingly replicated states in order to store a finite amount of extra information. A Turing machine can remember one of k different constants by copying its states k times, once for each possible value, and wiring those states appropriately. We will see this used next time.

Turing Machines and Lists Turing machines can perform many operations on lists: Concatenate two lists. Reverse a list. Sort a list. Find the maximum element of a list. And a whole lot more!

Summary for Today Turing machines are powerful computing devices, but can be tricky to program. Three useful techniques: Recursion: Try solving problems by recursively simplifying them. Subroutines: Have different parts of the machine do different things. Constant storage: Hold a constant amount of information in the finite-state control.

Next Time The Power of Turing Machines Recognition vs. Decision. Multitrack Turing machines. Instantaneous Descriptions. Nondeterministic Turing machines.