Turing Machine Extensions

Similar documents
One Minute To Learn Programming: Finite Automata

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Homework 3 Solutions

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

Algebra Review. How well do you remember your algebra?

Unambiguous Recognizable Two-dimensional Languages

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

Lecture 3 Gaussian Probability Distribution

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

Regular Sets and Expressions

Math 135 Circles and Completing the Square Examples

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall Final Exam

Binary Representation of Numbers Autar Kaw

Regular Languages and Finite Automata

Operations with Polynomials

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Integration by Substitution

Quick Reference Guide: One-time Account Update

Factoring Polynomials

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS Spring 2009

Reasoning to Solve Equations and Inequalities

Experiment 6: Friction

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Small Business Networking

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

Small Business Networking

Lecture 5. Inner Product

Treatment Spring Late Summer Fall Mean = 1.33 Mean = 4.88 Mean = 3.

4.11 Inner Product Spaces

9 CONTINUOUS DISTRIBUTIONS

MODULE 3. 0, y = 0 for all y

Graphs on Logarithmic and Semilogarithmic Paper

Object Semantics Lecture 2

Small Business Networking

Warm-up for Differential Calculus

0.1 Basic Set Theory and Interval Notation

FAULT TREES AND RELIABILITY BLOCK DIAGRAMS. Harry G. Kwatny. Department of Mechanical Engineering & Mechanics Drexel University

Section 7-4 Translation of Axes

EQUATIONS OF LINES AND PLANES

AntiSpyware Enterprise Module 8.5

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

Small Business Networking

Vectors Recap of vectors

6.2 Volumes of Revolution: The Disk Method

How To Network A Smll Business

flex Regular Expressions and Lexical Scanning Regular Expressions and flex Examples on Alphabet A = {a,b} (Standard) Regular Expressions on Alphabet A

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

Chapter 6. Logic and Action. 6.1 Actions in General

e.g. f(x) = x domain x 0 (cannot find the square root of negative values)

19. The Fermat-Euler Prime Number Theorem

SPECIAL PRODUCTS AND FACTORIZATION

A Visual and Interactive Input abb Automata. Theory Course with JFLAP 4.0

Small Business Cloud Services

All pay auctions with certain and uncertain prizes a comment

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

MATH 150 HOMEWORK 4 SOLUTIONS

Protocol Analysis / Analysis of Software Artifacts Kevin Bierhoff

CHAPTER 11 Numerical Differentiation and Integration

baby on the way, quit today

Helicopter Theme and Variations

Or more simply put, when adding or subtracting quantities, their uncertainties add.

Chapter. Contents: A Constructing decimal numbers

Exponential and Logarithmic Functions

2 DIODE CLIPPING and CLAMPING CIRCUITS

1.2 The Integers and Rational Numbers

Quick Reference Guide: Reset Password

Physics 43 Homework Set 9 Chapter 40 Key

Review guide for the final exam in Math 233

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

5 a LAN 6 a gateway 7 a modem

Basic Analysis of Autarky and Free Trade Models

UNIVERSITY OF OSLO FACULTY OF MATHEMATICS AND NATURAL SCIENCES

Decision Rule Extraction from Trained Neural Networks Using Rough Sets

Novel Methods of Generating Self-Invertible Matrix for Hill Cipher Algorithm

How To Set Up A Network For Your Business

Solving BAMO Problems

Answer, Key Homework 10 David McIntyre 1

Health insurance marketplace What to expect in 2014

The Velocity Factor of an Insulated Two-Wire Transmission Line

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

Virtual Machine. Part II: Program Control. Building a Modern Computer From First Principles.

Enterprise Risk Management Software Buyer s Guide

FORMAL LANGUAGES, AUTOMATA AND THEORY OF COMPUTATION EXERCISES ON REGULAR LANGUAGES

Drawing Diagrams From Labelled Graphs

Outline of the Lecture. Software Testing. Unit & Integration Testing. Components. Lecture Notes 3 (of 4)

The Definite Integral

Section 5-4 Trigonometric Functions

Week 11 - Inductance

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn

Health insurance exchanges What to expect in 2014

Geometry 7-1 Geometric Mean and the Pythagorean Theorem

Java CUP. Java CUP Specifications. User Code Additions You may define Java code to be included within the generated parser:

Chapter 2 The Number System (Integers and Rational Numbers)

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Econ 4721 Money and Banking Problem Set 2 Answer Key

AAPT UNITED STATES PHYSICS TEAM AIP 2010

Transcription:

Red K & S 4.3.1, 4.4. Do Homework 19. Turing Mchine Extensions Turing Mchine Definitions An lterntive definition of Turing mchine: (K, Σ, Γ, δ, s, H): Γ is finite set of llowble tpe symbols. One of these is. Σ is subset of Γ not including, the input symbols. δ is function from: K Γ to K (Γ - { }) {, } stte, tpe symbol, L or R b b Exmple trnsition: ((s, ), (s, b, )) Remember the gol: Do these Differences Mtter? Define device tht is: powerful enough to describe ll computble things, simple enough tht we cn reson formlly bout it Both definitions re simple enough to work with, lthough detils my mke specific rguments esier or hrder. But, do they differ in their power? Answer: No. Consider the differences: One wy or two wy infinite tpe: we're bout to show tht we cn simulte two wy infinite with ours. Rewrite nd move t the sme time: just ffects (linerly) the number of moves it tkes to solve problem. Turing Mchine Extensions In fct, there re lots of extensions we cn mke to our bsic Turing mchine model. They my mke it esier to write Turing mchine progrms, but none of them increse the power of the Turing mchine becuse: We cn show tht every extended mchine hs n equivlent bsic mchine. We cn lso plce bound on ny chnge in the complexity of solution when we go from n extended mchine to bsic mchine. Some possible extensions: Multiple tpes Two-wy infinite tpe Multiple red heds Two dimensionl sheet insted of tpe Rndom ccess mchine Nondeterministic mchine Lecture Notes 23 Turing Mchine Extensions 1

Multiple Tpes b b b b b 1 2 2 1 The trnsition function for k-tpe Turing mchine: ((K-H), Σ 1 to (K, Σ 1' {, }, Σ 2, Σ 2' {, },.,.,.,., Σ k ), Σ k' {, }) Input: input s before on tpe 1, others blnk Output: output s before on tpe 1, others ignored Copying string An Exmple of Two Tpe Mchine b b b b b b b b b b Lecture Notes 23 Turing Mchine Extensions 2

Another Two Tpe Exmple - Addition 1 0 1 ; 1 1 0 0 0 0 0 1 1 0 1 0 1 Adding Tpes Adds No Power Theorem: Let M be k-tpe Turing mchine for some k 1. Then there is stndrd Turing mchine M' where Σ Σ', nd such tht: For ny input string x, M on input x hlts with output y on the first tpe iff M' on input x hlts t the sme hlting stte nd with the sme output on its tpe. If, on input x, M hlts fter t steps, then M' hlts fter number of steps which is O(t ( x + t)). Proof: By construction b 0 0 1 0 0 0 0 b b b 0 1 0 0 0 0 0 Alphbet (Σ') of M' = Σ (Σ {0, 1}) k e.g.,, (, 0,, 0), (, 0,, 1) The Opertion of M' b 0 0 1 0 0 0 0 b b b 0 1 0 0 0 0 0 1. Set up the multitrck tpe: 1) Shift input one squre to right, then set up ech squre ppropritely. 2. Simulte the computtion of M until (if) M would hlt: (strt ech step to the right of the divided tpe) 1) Scn left nd store in the stte the k-tuple of chrcters under the red heds. Move bck right. 2) Scn left nd updte ech trck s required by the trnsitions of M. Move bck right. i) If necessry, subdivide new squre into trcks. 3. When M would hlt, reformt the tpe to throw wy ll but trck 1, position the hed correctly, then go to M's hlt stte. How Mny Steps Does M' Tke? Let: x be the input string, nd t be the number of steps it tkes M to execute. Step 1 (initiliztion) Step 2 ( computtion) Number of psses = t Work t ech pss: Totl = O(t ( x + t)) Step 3 (clen up) Totl = O(t ( x + t)) O( x ) 2.1 = 2 (length of tpe) = 2 ( x + 2 + t) 2.2 = 2 ( x + 2 + t) O(length of tpe) Lecture Notes 23 Turing Mchine Extensions 3

Our current definition: Two-Wy Infinite Tpe b c d Proposed definition: g f e b c d Simultion: Trck 1 b c d Trck 2 e f g The components of PDA: Finite stte controller Input tpe Stck The simultion: Finite stte controller: Input tpe: Stck: Simulting PDA Trck 1 b b (Input) Trck 2 Corresponding to Simulting Turing Mchine with PDA with Two Stcks b # b # b b Lecture Notes 23 Turing Mchine Extensions 4

Rndom Access Turing Mchines A rndom ccess Turing mchine hs: fixed number of registers finite length progrm, composed of instructions with opertors such s red, write, lod, store, dd, sub, jump tpe progrm counter Theorem: Stndrd Turing mchines nd rndom ccess Turing mchines compute the sme things. Furthermore, the number of steps it tkes stndrd mchine is bounded by polynomil in the number of steps it tkes rndom ccess mchine. Nondeterministic Turing Mchines A nondeterministic Turing mchine is quintuple (K, Σ,, s, H) where K, Σ, s, nd H re s for stndrd Turing mchines, nd is subset of ((K - H) Σ) (K (Σ {, })) bb bb bb bb bbb Wht does it men for nondeterministic Turing mchine to compute something? Semidecides - t lest one hlts. Decides -? Computes -? Nondeterministic Semideciding Let M = (K, Σ,, s, H) be nondeterministic Turing mchine. We sy tht M ccepts n input w (Σ - {, })* iff (s, w) yields lest one ccepting configurtion. We sy tht M semidecides lnguge L (Σ - {, })* iff for ll w (Σ - {, })*: w L iff (s, w) yields lest one hlting configurtion. An Exmple L = {w {, b, c, d}* : there re two of t lest one letter} / 2 / / b/ 0 / 1 b/ 3 b h c/ c/ c d/ 4 d/ d 5 Lecture Notes 23 Turing Mchine Extensions 5

M decides lnguge L if, for ll w (Σ - {, })* : 1. ll of M's computtions on w hlt, nd 2. w L iff t lest one of M's computtions ccepts. M computes function f if, for ll w (Σ - {, })* : 1. ll of M's computtions hlt, nd 2. ll of M's computtions result in f(w) Note tht ll of M's computtions hlt iff: Nondeterministic Deciding nd Computing There is nturl number N, depending on M nd w, such tht there is no configurtion C stisfying (s, w) - M N C. An Exmple of Nondeterministic Deciding L = {w {0, 1}* : w is the binry encoding of composite number} M decides L by doing the following on input w: 1. Nondeterministiclly choose two binry numbers 1 < p, q, where p nd q w, nd write them on the tpe, fter w, seprted by ;. 110011;111;1111 2. Multiply p nd q nd put the nswer, A, on the tpe, in plce of p nd q. 110011;1011111 3. Compre A nd w. If equl, go to y. Else go to n. Equivlence of Deterministic nd Nondeterministic Turing Mchines Theorem: If nondeterministic Turing mchine M semidecides or decides lnguge, or computes function, then there is stndrd Turing mchine M' semideciding or deciding the sme lnguge or computing the sme function. Note tht while nondeterminism doesn t chnge the computtionl power of Turing Mchine, it cn exponentilly increse its speed! Proof: (by construction) For semideciding: We build M', which runs through ll possible computtions of M. If one of them hlts, M' hlts Recll the wy we did this for FSMs: simulte being in combintion of sttes. Will this work here? Wht bout: Try pth 1. If it ccepts, ccept. Else Try pth 2. If it ccepts, ccept. Else Lecture Notes 23 Turing Mchine Extensions 6

The Construction At ny point in the opertion of nondeterministic mchine M, the mximum number of brnches is r = K ( Σ + 2) sttes ctions So imgine tble: 1 2 3 r (q1,σ1) (p-,σ-) (p-,σ-) (p-,σ-) (p-,σ-) (p-,σ-) (q1,σ2) (p-,σ-) (p-,σ-) (p-,σ-) (p-,σ-) (p-,σ-) (q1,σn) (q2,σ1) (q K,σn) Note tht if, in some configurtion, there re not r different legl things to do, then some of the entries on tht row will repet. M d : (suppose r = 6) Tpe 1: Input The Construction, Continued Tpe 2: 1 3 2 6 5 4 3 6 M d chooses its 1st move from column 1 M d chooses its 2nd move from column 3 M d chooses its 3rd move from column 2 until there re no more numbers on Tpe 2 M d either: discovers tht M would ccept, or comes to the end of Tpe 2. In either cse, it hlts. M' (the mchine tht simultes M): Tpe 1: Input The Construction, Continued Tpe 2: Copy of Input Tpe 3: 1 3 2 6 5 4 3 6 M d Steps of M': write ε on Tpe 3 until M d ccepts do (1) copy Input from Tpe 1 to Tpe 2 (2) run M d (3) if M d ccepts, exit (4) otherwise, generte lexicogrphiclly next string on Tpe 3. Pss 1 2 3 7 8 9 Tpe3 ε 1 2 6 11 12 2635 Lecture Notes 23 Turing Mchine Extensions 7

Nondeterministic Algorithms Other Turing Mchine Extensions Multiple heds (on one tpe) Emultion strtegy: Use trcks to keep trck of tpe heds. (See book) Multiple tpes, multiple heds Emultion strtegy: Use trcks to keep trck of tpes nd tpe heds. Two-dimensionl semi-infinite tpe Emultion strtegy: Use digonl enumertion of two-dimensionl grid. Use second tpe to help you keep trck of where the tpe hed is. (See book) Two-dimensionl infinite tpe (relly sheet) Emultion strtegy: Use modified digonl enumertion s with the semi-infinite cse. Wht About Turing Mchine Restrictions? Cn we mke Turing mchines even more limited nd still get ll the power? Exmple: We llow tpe lphbet of rbitrry size. Wht hppens if we limit it to: One chrcter? Two chrcters? Three chrcters? Lecture Notes 23 Turing Mchine Extensions 8

Red K & S 5.1 & 5.2. Problem Encoding, TM Encoding, nd the Universl TM Encoding Problem s Lnguge A Turing Mchines deciding lnguge is nlogous to the TM solving decision problem. Problem: Is the number n prime? Instnce of the problem: Is the number 9 prime? Encoding of the problem, n : n s binry number. Exmple: 1001 Problem: Is n undirected grph G connected? Instnce of the problem: Is the following grph connected? 1 2 3 4 5 Encoding of the problem, G : 1) V s binry number 2) A list of edges represented by pirs of binry numbers being the vertex numbers tht the edge connects 3) All such binry numbers re seprted by /. Exmple: 101/1/10/10/11/1/100/10/101 Problem View vs. Lnguge View Problem View: It is unsolvble whether Turing Mchine hlts on given input. This is clled the Hlting Problem. Lnguge View: Let H = { M, w : TM M hlts on input string w} H is recursively enumerble but not recursive. Problem: All our mchines so fr re hrdwired. The Universl Turing Mchine Question: Does it mke sense to tlk bout progrmmble Turing mchine tht ccepts s input progrm input string executes the progrm, nd outputs output string Yes, it's clled the Universl Turing Mchine. Notice tht the Universl Turing mchine semidecides H = { M, w : TM M hlts on input string w} = L(U). To define the Universl Turing Mchine U we need to do two things: 1. Define n encoding opertion for Turing mchines. 2. Describe the opertion of U given n input tpe contining two inputs: encoded Turing mchine M, encoded input string to be given to M. Lecture Notes 24 Problem Encoding, Turing Mchine Encoding, nd the Universl Turing Mchine 1

Encoding Turing Mchine M We need to describe M = (K, Σ, δ, s, H) s string. To do this we must: 1. Encode δ 2. Specify s. 3. Specify H (nd y nd n, if pplicble) 1. To encode δ, we need to: 1. Encode the sttes 2. Encode the tpe lphbet 3. Specify the trnsitions 1.1 Encode the sttes s qs : s {0, 1} + nd s = i nd i is the smllest integer such tht 2 i K Exmple: 9 sttes i = 4 s = q0000, remining sttes: q0001, q0010, q0011, q0100, q0101, q0110, q0111, q1000 Encoding Turing Mchine M, Continued 1.2 Encode the tpe lphbet s s : s {0, 1} + nd s = j nd j is the smllest integer such tht 2 j Σ + 2 (the + 2 llows for nd ) Exmple: Σ = {,,, b} j = 3 = 000 = 001 = 010 = 011 = 100 b = 101 Encoding Turing Mchine M, Continued 1.3 Specify trnsitions s (stte, input, stte, output) Exmple: (q00,000,q11,000) 2. Specify s s q0 i 3. Specify H: Sttes with no trnsitions out re in H. If M decides lnguge, then H = {y, n}, nd we will dopt the convention tht y is the lexicogrphiclly smller of the two sttes. y = q010 n = q011 Encoding Input Strings We encode input strings to mchine M using the sme chrcter encoding we use for M. For exmple, suppose tht we re using the following encoding for symbols in M: symbol Then we would represent the string s = s representtion 000 001 010 011 100 "s" = s = 001100100000100 Lecture Notes 24 Problem Encoding, Turing Mchine Encoding, nd the Universl Turing Mchine 2

An Encoding Exmple Consider M = ({s, q, h}, {,,}, δ, s, {h}), where δ = stte symbol δ s (q, ) s (h, ) s (s, ) q (s, ) q (s, ) q (q, ) stte/symbol s q h representtion q00 q01 q11 000 001 010 011 100 The representtion of M, denoted, "M", M, or sometimes ρ(m) = (q00,100,q01,000), (q00,000,q11,000), (q00,001,q00,011), (q01,100,q00,100), (q01,000,q00,011), (q01,001,q01,011) Another Win of Encoding One big win of defining wy to encode ny Turing mchine M: It will mke sense to tlk bout opertions on progrms (Turing mchines). In other words, we cn tlk bout some Turing mchine T tht tkes nother Turing mchine (sy M 1 ) s input nd trnsforms it into different mchine (sy M 2 ) tht performs some different, but possibly relted tsk. Exmple of trnsforming TM T: Input: mchine M 1 tht reds its input tpe nd performs some opertion P on it. Output: mchine M 2 tht performs P on n empty input tpe: >R x L R M 1 The specifiction for U: U("M" "w") = "M(w)" The Universl Turing Mchine "M ------------------------------ M" "w------------------------w" 1 0 0 0 0 0 0 " " "w--------------------w" 1 0 0 0 0 0 0 "M ---------------------------- M" 1 0 0 0 0 0 0 q 0 0 0 1 Initiliztion of U: 1. Copy "M" onto tpe 2 2. Insert " " t the left edge of tpe 1, then shift w over. 3. Look t "M", figure out wht i is, nd write the encoding of stte s on tpe 3. Lecture Notes 24 Problem Encoding, Turing Mchine Encoding, nd the Universl Turing Mchine 3

Simulte the steps of M: The Opertion of U 0 0 1 0 0 1 0 0 0 0 0 0 "M ---------------------------- M" 1 0 0 0 0 0 0 q 0 0 0 1 1. Strt with the heds: tpe 1: the of the chrcter being scnned, tpe 2: fr left tpe 3: fr left 2. Simulte one step: 1. Scn tpe 2 for qudruple tht mtches current stte, input pir. 2. Perform the ssocited ction, by chnging tpes 1 nd 3. If necessry, extend the tpe. 3. If no qudruple found, hlt. Else go bck to 2. Tpe 1: 001000100100000100 Tpe 2: (q00,000,q11,000), (q00,001,q00,011), (q00,100,q01,000), (q01,000,q00,011), (q01,001,q01,011), (q01,100,q00,100) Tpe 3: q01 An Exmple Result of simulting the next step: Tpe 1: 001000100100000100 Tpe 3: q00 Could we define Universl Finite Stte Mchine? If A Universl Mchine is Such Good Ide Such FSM would ccept the lnguge L = {"F" "w" : F is finite stte mchine, nd w L(F) } Lecture Notes 24 Problem Encoding, Turing Mchine Encoding, nd the Universl Turing Mchine 4