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

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

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

Part I: Definitions and Properties

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

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

CSE 105 THEORY OF COMPUTATION

Variations of the Turing Machine

Chapter 3: The Church-Turing Thesis

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

CSCC63 Worksheet Turing Machines

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

CSCI3390-Assignment 2 Solutions

CS21 Decidability and Tractability

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

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

CS4026 Formal Models of Computation

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

THEORY OF COMPUTATION

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

Homework. Context Free Languages. Announcements. Before We Start. Languages. Plan for today. Final Exam Dates have been announced.

Computability Theory. CS215, Lecture 6,

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

Turing s Thesis. Fall Costas Busch - RPI!1

1 Showing Recognizability

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

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

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CS 525 Proof of Theorems 3.13 and 3.15

Introduction to Turing Machines

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

Turing Machines Part II

ECS 120 Lesson 15 Turing Machines, Pt. 1

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

Turing Machines. Chapter 17

Chapter 7 Turing Machines

Most General computer?

Automata Theory CS S-12 Turing Machine Modifications

Decidability: Church-Turing Thesis

Computable Functions

The Church-Turing Thesis

CSE 105 THEORY OF COMPUTATION

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

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

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

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

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

where Q is a finite set of states

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Computability and Complexity

Turing Machines. Lecture 8

CS 361 Meeting 26 11/10/17

Lecture 1: Course Overview and Turing machine complexity

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

Introduction to Turing Machines. Reading: Chapters 8 & 9

TURING MAHINES

CpSc 421 Homework 9 Solution

Chapter 8. Turing Machine (TMs)

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

Lecture 14: Recursive Languages

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

Turing Machines Part III

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

Theory of Computation

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

Non-emptiness Testing for TMs

CSE 105 THEORY OF COMPUTATION

Complexity Theory Part I

A Universal Turing Machine

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

Variants of Turing Machine (intro)

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

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

CSE 105 Theory of Computation

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

CSCI FOUNDATIONS OF COMPUTER SCIENCE

A Note on Turing Machine Design

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

Foundations of

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

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Decidability and Undecidability

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

Turing Machines and the Church-Turing Thesis

Turing Machine Variants. Sipser pages

CS 410/610, MTH 410/610 Theoretical Foundations of Computing

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CSE 105 THEORY OF COMPUTATION

Theory of Computation

Lecture 1: Introduction

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

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

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

Decidable Languages - relationship with other classes.

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

Turing Machines Part Two

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

CPSC 421: Tutorial #1

Transcription:

Homework s TM Variants and the Universal TM Homework #6 returned Homework #7 due today Homework #8 (the LAST homework!) Page 262 -- Exercise 10 (build with JFLAP) Page 270 -- Exercise 2 Page 282 -- Exercise 10 (please explain your answer) Page 309 -- Exercise 2a,b Page 315 -- Exercise 1 (try before looking in back of book) Due 11 / 7 Announcements Final Exam Dates have been announced Friday, November 17 10:15am -- 12:15pm Room 70-3435 Plan for today 1st half Variants and Universal TM 2nd Half Languages associated with TMs Conflicts? Let me know. Languages Is that your final answer? 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 1

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 s s Let s formalize this A M is a 7-tuple: M = (Q, Σ, Γ, δ, q 0,, F) where Q = a finite set of states Σ = input alphabet (strings to be used as input) Γ = tape alphabet (chars that can be written onto the tape. Includes symbols from Σ) q 0 = start state = the blank symbol ( Γ, Σ) F = set of final states δ = transition function Transition function: δ: Q x Γ Q x Γ x {R, L} Input: Current state Tape symbol read at current position of tape head Output: State in which to move the machine Tape symbol to write at the current position of the tape head Direction in which to move the tape head (R = right, L = left) TMs and halting We say that a TM halts if The machine has nowhere to go (at a state, reading a symbol where no transition is defined) Without loss of generality, we can assume that a TM will always halt when in an accepting state. Note that the TM can halt in a non-accepting state! Running a The execution of a TM can result in 3 possible cases: The machine halts in an accepting state (ACCEPT) The machine halts in a non-accepting state (REJECT) The machine goes into an infinite loop (REJECT but keeps us guessing!) 2

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 an accepting state. I.e. q 0 x a * αpβ and p F Language accepted by a TM The language accepted by a TM is the set of all input strings x on which the machine halts in an accepting state. Questions? properties Alternate TM definitions There are many ways to skin a cat And many ways to define a TM The book s Standard s Tape unbounded on both sides Deterministic (at most 1 move / configuration) Tape acts as both input and output The books looks at a number of alternate (and equivalent) definitions. s with a STAY Option Allows the tape head to stay where it is δ: Q x Γ Q x Γ x {R, L, S} Basic TM defined in JFLAP TM with semi-infinite tape Tape is bounded on the left Any attempt to go beyond this boundary will result in halt and reject. Alternate TM definitions Alternate TM definitions Off-line TM TM with 2 tapes Read-only input tape Read-write tape Input file + memory Non-deterministic TM Machine has a choice of moves δ: Q x Γ 2 Q x Γ x {R, L} More on this next week. All of the alternate definitions are equivalent to the standard TM I.e Given an alternate TM that accepts L, one can construct a standard TM that accepts the same language. 3

Alternate TM definitions Multi-taped TMs Have multiple tapes With a multiple tape heads that is read/writing a different position on each tape at any one given time. δ: Q x Γ n Q x Γ n x {R, L} n where n is #of tapes Variants Variants Multitape TM Move of a multitape TM Will depend upon: The state of the machine The symbol being read on all of the tape heads Result: Each of the tape heads will write a new symbol on the tape Each of the tape heads will move left, right, or stationery Tape heads can move independently. Multitape TM Example {ww R w is a string in {a,b} * } Even length palandromes 2-tapes Step 1: Copy contents of tape 1 to tape 2 Step 2: position head of tape 1 at beginning of tape and head of tape 2 at end Step 3: Compare strings character by character Multitape TM A TM M u that takes as input, an encoded version of another TM M and an input w to M. M u will simulate the processing w on M If M halts on input w, M u will halt If M rejects on input w,m u will reject. Questions? M u is a general purpose TM M is a program run on the general purpose TM 4

Encoding scheme We need a way to encode a TM so that it can be provided as input to T u Define sets: Q = {q 1, q 2, } = set of all possible states that may appear in any TM S = {a 1, a 2, a 3, } = set of all possible tapes symbols that can be written on any TM. So for any TM Q Q and Γ S Assumptions q 1 will always be the start state There will only be 1 final state It will be q 2 The machine always halts in q 2 Encoding scheme Associate states, symbols, and directions with binary numbers: States: s(q i ) 1 i Symbols s(a i ) 1 i Directions: s(l) 1 s(r) 11 Encoding scheme Encoding transitions: Encode each state, symbol, direction Separate by 0 The transition δ (p,a) = (q, b, D) can be encoded as: s(p)0s(a)0s(q)0s(b)0s(d) Encoding Encoding for a TM Encode each of it s moves Separate by 0 s e(t) = e(m 1 )0e(m 2 )0 0e(m k )0 The input to M u will be an encoded TM and a string w to run on that TM We encode x by individually encoding the characters of x (separated by 1 s) x = z 1 z 2 z n e(x) = s(z 1 )0s(z 2 )0 0s(z n )0 5

Encoding Scheme Finally, the description of the TM and the encoding of the string to run on the TM will be separated by a blank Input to M u e(m) e(x) Encoding example States q 1 state 1 q 2 state 2 q 3 state 3 q 4 state 4 Symbols B symbol 1 a symbol 2 b symbol 3 Encoding example States q 1 state 1 q 2 state 2 q 3 state 3 q 4 state 4 Symbols B symbol 1 a symbol 2 b symbol 3 Directions s(l) 1 s(r) 11 1 0 1 0 111 0 1 0 11 Encoding scheme The actual scheme isn t really important (in fact, there are many) What is important is that we can encode a TM and it s input as a binary string. This encoding defines a unique serial number to each TM The set of all TMs is countably infinite We can define a one-to-one and onto function between the set of TMs and the set of natural numbers { 0, 1, 2, } Uncountably infinite sets are larger than countably infinite sets How it works 3 tape TM Tape 1 Working tape Tape 2 Input and output tape Tape 3 encoded form of the state that machine being simulated is in Note that a 3 tape TM is equivalent to a basic TM. 6

How it works On a single move, The symbol on each tape is read The symbol on each tape is written The tape head for Read head(s) each tape is moved State independently Machine (program) How it works When we start e(t) e(x) is on tape 1 Step 1: Move e(x) from tape 1 to tape 2 and delete from tape 1 Tape 2: e(x) Step 2: Copy encoded initial state of T to tape 3 Tape 3: s(q 1 ) How it works Step 3: Now simulation begins read and replace character on tape 2 read state on tape 3 find a transition in the encoded machine on tape 1. Replace destination state onto tape 3 Replace character on tape 2. Move head on tape 2 appropriately How will the machine finish? The TM being simulated has nowhere to go. M u will never find a suitable transition The TM being simulated goes into an infinite loop M u will continually simulate these moves The TM being simulated halts M u will halt with halt state on it s 3 rd tape M u will copy the contents of Tape 2 to Tape 1 Reality check: What have we done? Defined: A means to encode a TM as a binary string Defines it s serial number Set of all TMs is infinitely countable A Universal TM (M u ) that takes as input: An encoded TM, M An encoded input string, w That will simulate the running of w on M Break 7