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

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

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

Turing Machine properties. Turing Machines. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions

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

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

Chapter 3: The Church-Turing Thesis

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

Computability Theory. CS215, Lecture 6,

Introduction to Turing Machines

Most General computer?

Chapter 7 Turing Machines

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

Part I: Definitions and Properties

CS4026 Formal Models of Computation

Fundamentals of Computer Science

CSE 105 Theory of Computation

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

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

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

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

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

Turing Machines Part III

ECS 120 Lesson 15 Turing Machines, Pt. 1

CSE 105 THEORY OF COMPUTATION

The Church-Turing Thesis

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

CSCC63 Worksheet Turing Machines

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

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

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Theory of Computation (IX) Yijia Chen Fudan University

CSCI3390-Assignment 2 Solutions

CPSC 421: Tutorial #1

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

CISC4090: Theory of Computation

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

1 Unrestricted Computation

CS21 Decidability and Tractability

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

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. The stack

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

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

Lecture 13: Turing Machine

Decidable Languages - relationship with other classes.

CSE 105 THEORY OF COMPUTATION

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

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

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

UNIT-VIII COMPUTABILITY THEORY

Decidability: Church-Turing Thesis

Turing s Thesis. Fall Costas Busch - RPI!1

Automata Theory - Quiz II (Solutions)

Equivalent Variations of Turing Machines

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

Turing Machine Variants

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

Turing Machines. Lecture 8

Theory of Computation

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

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

Reducability. Sipser, pages

Turing Machines Part II

Further discussion of Turing machines

Turing Machines. Chapter 17

Variants of Turing Machine (intro)

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

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

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Lecture 12: Mapping Reductions

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CSE 105 THEORY OF COMPUTATION

The Turing machine model of computation

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

Homework Assignment 6 Answers

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

Lecture 14: Recursive Languages

Decidability and Undecidability

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

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

Turing Machines. Nicholas Geis. February 5, 2015

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

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

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

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Theory of Computation

Turing machines and computable functions

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

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

Turing Machines, diagonalization, the halting problem, reducibility

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

Automata Theory CS S-12 Turing Machine Modifications

Decidability. William Chan

Turing Machines. Wolfgang Schreiner

where Q is a finite set of states

Transcription:

Before We Start s Any questions? Languages The $64,000 Question What is a language? What is a class of languages? Now our picture looks like Context Free Languages Deterministic Context Free Languages Regular Languages Finite Languages We re going to start to look at languages out here The We investigate the next classes of languages by first considering the machine Developed by Alan Turing in 1936 More than just recognizing languages Foundation for modern theory of computation Theory Hall of Fame Alan Turing 1912 1954 b. London, England. PhD Princeton (1938) Research Cambridge and Manchester U. National Physical Lab, UK Creator of the Turing Test 1

More about Turing Breaking the Code Movie about the personal life of Alan Turing Death was by cyanide poisoning (some say suicide) Turing worked as a code breaker for the Allies during WWII. Turing eventually tried to build his machine and apply it to mathematics, code breaking, and games (chess). Was beat to the punch by vonneumann The Some history Created in response to Kurt Godel s 1931 proof that formal mathematics was incomplete There exists logical statements that cannot be proven by using formal deduction from a set of rules Good Reading: Godel, Escher, Bach by Hofstadter Turing set out to define a process by which it can be decided whether a given mathematical can be proven or not. Theory Hall of Fame Kurt Godel 1906 -- 1978 b. Brünn, Austria-Hungary PhD University of Vienna (1929) Research Princeton University Godel s Incompleteness Theorem The Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine provides a means to determine: If an algorithm or procedure exists for a given problem What that algorithm or procedure looks like How long would it take to run this algorithm or procedure. The Church-Turing Thesis (1936) Any algorithmic procedure that can be carried out by a human or group of humans can be carried out by some Turing Machine Equating algorithm with running on a TM is still a valid computational model for most modern computers. Theory Hall of Fame Alonso Church 1903 -- 1995 b. Washington D.C. PhD Princeton (1927) Mathematics Prof (1927 1967) Advisor to both Turing and Kleene 2

A Machine consists of: A state machine An input tape A movable r/w tape head A move of a Turning Machine Read the character on the tape at the current position of the tape head Change the character on the tape at the current position of the tape head Move the tape head Change the state of the machine based on current state and character read Input tape (input/memory)... Read head State Machine (program) Tape that holds character string Movable tape head that reads and writes character Machine that changes state based on what is read in In the original The read tape was infinite in both directions The text describes a semi-infinite TM where The tape is bounded on the left and infinite on the right It can be shown that the semi-infinite TM is equivalent to the basic TM. As not to confuse, I ll follow the conventions in the book (as much as that bothers me!) s About the input tape Bounded to the left, infinite to the right All cells on the tape are originally filled with a special blank character Tape head is read/write Tape head can not move to the left of the start of the tape If it tries, the machine crashes s About the machine states A does not have a set of accepting states Instead, each TM has a special halting state, h. Once in the halting state, the machine halts. Unlike PDAs, the basic TM is deterministic! s Let s formalize this A M is a 5-tuple: M = (Q, Σ, Γ, q 0, δ) where Q = a finite set of states (assumed not to contain the halting state h) Σ = input alphabet (strings to be used as input) Γ = tape alphabet (chars that can be written onto the tape. Includes symbols from Σ) Both Σ and Γ are assumed not to contain the blank symbol δ = transition function 3

s s Transition function: δ: Q x (Γ { }) (Q {h}) x (Γ { }) x {R, L, S} Input: Current state Tape symbol read at current position of tape head Output: State in which to move the machine (can be the halting state) Tape symbol to write at the current position of the tape head (can be the blank symbol) Direction in which to move the tape head (R = right, L = left, S= stationary) Transition Function Symbol at current tape head position Symbol to write at the current head position X / Y, R q 0 q 1 Direction in which to move the tape head Configuration of a TM Gives the current configuration of a TM Current state (q, xay) Underlined character is current position of the tape head Current contents of the tape (without trailing blanks) We indicate (q, xay) a (p, ubv) If you can go from one configuration to another on a single move, and (q, xay) a * (p, ubv) If you can go from one configuration to another on 0 or more moves. Initial configuration: To run an input string x on a TM, Start in the stating state place the string after the leftmost blank on the tape place the head at this leftmost blank: (q 0, x) Running a The execution of a TM can result in 4 possible cases: The machine halts (ends up in the halting state) The machine has nowhere to go (at a state, reading a symbol where no transition is defined) The machine crashes (tries to move the tape head to before the start of the tape) The machine goes into an infinite loop (never halts) 4

Accepting a string A string x is accepted by a TM, if Starting in the initial configuration With x on the input tape The machine eventually ends up in the halting state. I.e. (q 0, x) a * (h, xay) for x,y (Γ { }) *, a (Γ { }) Running a The execution of a TM can result in 4 possible cases: The machine halts (ACCEPT) The machine has nowhere to go (REJECT) The machine crashes (REJECT) The machine goes into an infinite loop (REJECT but keeps us guessing!) Language accepted by a TM The language accepted by a TM is the set of all input strings x on which the machine halts. TMs and Regular Languages L = { x { a, b } * x contains the substring aba } b a a,b Questions? a b a b TMs and Regular Languages TMs and Regular Languages L = { x { a, b } * x contains the substring aba } b/b,r a/a,r Build a TM that mimics the FA that accepts this language 0 /,R a/a,r B/b,R b /b,r a /a,r h 5

TMs and Regular Languages Do you think that JFLAP can handle TMs? You bet! One difference, JFLAP simulates the original TM (with an infinite tape in both directions). Theory Hall of Fame Susan Rodgers PhD Purdue (1985) CSProf RPI (1989-1994) Duke (1995 present) Creator and keeper of JFLAP TMs and Regular Languages Observations Like FAs TM tape head will always move to the right Like FAs, TM will not write new chars onto the tape Can enter halt state even before the machine reads all the characters of x. Our old friend the palindrome: L = { x {a, b} * x = x r } We won t simulate a PDA since the PDA for pal is non-deterministic (we ll deal with nondeterministic TMs later). Example L = { x {a, b} * x = x r } Basic idea: Compare the first character with the last character. If they match compare the second character with the second to last character If they match, compare the 3 rd character with the 3 rd to last character And so on For x in pal, eventually we will end up with 0 or 1 unmatched characters. L = { x {a, b} * x = x r } How to compare characters? Read a character and replace it with blanks. Move across the tape to first blank character Check the character to the left If it s the character that you initially read in, replace it with a blank, move the tape head left until you reach the first blank character and so on. 6

L = { x {a, b} * x = x r } Halting condition: If when you moved left/right after finding the first blank, the character found is a blank, we have found a palindrome! Example L = { x {a, b} * x = x r } States: q 1 at the leftmost blank q 2 read an a, move right until you find a blank q 3 looking for an a, look left after finding rightmost blank q 4 matched first character read, move left till you find the leftmost blank q 5 read an b, move right until you find a blank q 6 looking for an b, look left after finding rightmost blank L = { x {a, b} * x = x r } Let s go to the video tape Let s try a non-context free language L = { xx x { a, b } * } Basic idea Find and mark the middle of the string Compare characters starting from the start of the string with characters starting from the middle of the string. Let s try a non-context free language L = {xx x { a, b } * } Finding the middle of the string Convert first character to it s upper case equiv. Move all the way to the right to the last lower case character and change it to upper case. Move all the way back left to the first lower case character and change it to upper case And so on. 7

Let s try a non-context free language Once you ve found the middle, Convert the 1 st half of the string back to lower case. Start from the left of the tape Match upper case chars in 1 st half with lower case chars in the 2 nd. Replace a matched upper case char with blanks Repeat until the 1 st half of the string is all blank. Let s try a non-context free language Find middle of string 1 st half to lower case Character matching Let s try a non-context free language Let s go to the video tape Questions? s Combining s Suppose an algorithm has a number of tasks to perform Each task has its own TM Much like subroutines or functions They can be combined into a single TM T 1 T 2 is the composite TM T 1 T 2 Combining s Composite TMs T 1 T 2 Start at start state of T 1 For any move that causes T 1 to enter the halt state, have T 1 move to the start state of T 2. So T 2 will get executed immediately after T 1 as long as T 1 will halt on a given input. Allows one to define subroutines. 8

Combining s Useful subroutines Copy TM Creates a copy of the input string to the right of the input separated by a blank (q 0, x) a * (h, x x) Basic idea Examines each character in turn and writes it after the 1 st blank to the right of the input string Keeps track of its progress by converting copied characters to upper case When finished, coverts original string back to lower case. Combining s Copy TM Combining s Useful subroutines Delete TM Deletes a character from a string (q, yaz) a * (h, yz) Basic idea: Replace the char to be deleted with a blank Go to the rightmost non-blank character of the string Move left towards the blanked out character shifting each character along the way to the left. Replace char with blank Go to end Combining s Delete TM Go backwards and shift Combining s Useful subroutines Delete TM Something to note The TM must be set up to be in the correct configuration before delete is called I.e. the tape head must be at the character to be deleted. Questions? Summary s Questions Stick around for homework help 9