CSC : Homework #3

Size: px
Start display at page:

Download "CSC : Homework #3"

Transcription

1 CSC : Homework #3 William J. Cook Monday, March 15, Exercise 4.13 on page 118 (3-Register RAM) Exercise 4.13 Verify that a RAM need not have an unbounded number of registers. Use prime encoding to show that a three-register RAM can simulate a k-register RAM for any fixed k> RAM Operations I will assume that a RAM has the following basic operations: Inc Rj adds one to register j. Dec Rj subtracts one from register j unless register j is zero in which case Dec Rj does nothing. JumpOnZero Rj, label jumps to the line of code labeled by label if register j is zero, else does nothing. Halt just halts the RAM. Rj l gives register j the value l. Rj Rl sets register j to the value of register l. Rj Rj +Rl sets register j to the value resulting from adding register l to register j. Rj Rj -Rl sets register j to the value resulting from subtracting register l from register j unless register l has a greater value than register j in which case the RAM just sets register j to zero. Rj Rj l sets register j to the value resulting from multiplying register j by l. Rj Rj l sets register j to the value resulting from dividing register j by l (integer division). Rj Rj mod l sets register j to the remainder resulting from dividing register j by l. 1

2 1.2 Unboundedness is Unnecessary The program of any RAM must be finite in length. Say the program for some given RAM is a list of n basic instructions. Each instruction refers to at most two different registers. Thus, the program could involve (at most) 2n different registers. Therefore, any given RAM uses only a finite number of registers. 1.3 Prime Encoding Let k be the maximum register index referred to by the program (this exists since the list of registers used is finite). These k +1registers(R0, R1,..., Rk) can be stored in a single register using prime encoding. Let{p 0,p 1,..., p k,p k+1,p k+2,p k+3 } be k + 4 distinct primes (I will need a few extra primes for some of the simulations). If Rj r j for all 0 j k, then we can encode all of the values, r j, in the first register via R0 k i=0 pr i i.noticethat r k+1 = r k+2 = r k+3 =0. Asamatterofconvention,Iwillrefertothe(k + 1)-register machine s registers as r 0,r 1,..., r k and the 3-register machine s registers as R0, R1, andr2. We begin with the input encoded in R Simulating Instructions Now let s simulate each basic instruction with a list of instructions which only use three registers. The (k + 1)-register machine s program instructions are to be replaced by copies of the following simulations in order to construct the program for the 3-register machine. Note: Each copy of a simulation will need to have its labels adjusted so that labels are unique. Also, some simulations are built out of previous ones. I put quotation marks around the instructions which need to be replaced by the corresponding simulation. For example, Inc Rj = R0 R0 p j Replace Inc Rj with: R0 R0 p j This increases the exponent of p j by one. Thus r j r j +1. 2

3 Replace Dec Rj with: R1 R1 mod p j JumpOnZero R1, divisible R1 0 JumpOnZero R1, notdivisible divisible: R0 R0 p j notdivisible: R1 0 First we need to check if r j = 0, if this is true then when we divide R1 by p j we should get a non-zero remainder so we will end up jumping to notdivisible and finishing. Otherwise, we divide R0 by p j and thus decrement the exponent r j by one (r j r j 1). Replace JumpOnZero Rj, label with: R1 R1 mod p j JumpOnZero R1, divisible R1 0 JumpOnZero R1, label divisible: R1 0 We need to check if r j = 0 just like in Dec Rj. We jump to divisible only when r j 0. This will dump us out of the simulation. However, if r j =0,wejumpto label. Note: the last R1 0 functions as a no-op. I will continue to use this type thing throughout all of the simluations to guarantee that each label has an instruction next to it. You may also want to note that all simulations end with R1 = R2 = 0. Halt needs no replacement. Replace Rj l with: again: R1 R1 mod p j JumpOnZero R1, divisible R1 0 JumpOnZero R1, notdivisible divisible: R0 R0 p j JumpOnZero R1, again notdivisible: R0 p l j As long as r j 0, we decrement r j by dividing R0 by p j. Once r j =0,wesetit to l by multiplying R0 by p l j.thatis:r j 0 l. 3

4 Replace Rj Rl with: Rj 0 again: R2 R1 R2 R2 mod p l JumpOnZero R2, divisible R2 0 JumpOnZero R2, notdivisible divisible: R1 R1 p l R0 R0 p j JumpOnZero R2, again notdivisible: R1 0 First we use the previous simulation to set r j = 0. We then copy all the registers in R0 into R1. Thus we can use R1 like a second set of registers. As long as r l 0(inR1), we decrement r l (in R1 thus leaving the original r l in R0 untouched) and increment r j in R0. Thusr j in R0 gets incremented r l times. Hence, r j 0 r l. Replace Rj Rj + Rl with: again: R2 R1 R2 R2 mod p l JumpOnZero R2, divisible R2 0 JumpOnZero R2, notdivisible divisible: R1 R1 p l R0 R0 p j JumpOnZero R2, again notdivisible: R1 0 This works exactly like the previous simulation except that we don t start off by resetting r j to zero. We get: r j r j + r l. 4

5 Replace Rj Rj - Rl with: again: R2 R1 R2 R2 mod p l JumpOnZero R2, divisible R2 0 JumpOnZero R2, notdivisible divisible: R2 R0 R2 R2 mod p j JumpOnZero R2, divisibletoo R2 0 JumpOnZero R2, notdivisible divisibletoo: R1 R1 p l R0 R0 p j JumpOnZero R2, again notdivisible: R1 0 First, copy memory into R1. If r l =0(inR1), there is nothing to subtract so we jump to notdivisible and end this simulation. Next, if r j =0(inR0), we cannot subtract anything else from r j so we must jump to notdivisible and end this simulation. But if both are not zero, we decrement r l (in R1) and decrement r j (in R0) and then repeat the process. Thus, if r j r l, we decrement r j a total of r l times and get: r j r j r l. Otherwise, we end up decrementing until r j =0. Replace Rj Rj l with: R1 l JumpOnZero R1, zerocase R(k +1) l again: Rj Rj + Rj Dec R(k +1) JumpOnZero R(k +1), done JumpOnZero R(k +2), again zerocase: Rj 0 done: R1 0 We can piece together previous simulations to make this simulation. First, if l = 0, we have kind of a weird case. If so, we jump to zerocase and set r j = 0. Otherwise, we use r k+1 as a counter. This is okay since the original RAM only uses the registers up through r k. Then we add r j to itself l = r k+1 times. Note: At the end of each simulation not only are R1 and R2 set to zero, but also r k+1, r k+2,andr k+3. 5

6 Replace Rj Rj l with: R(k +1) Rj R(k +2) l Rj 0 again: R(k +3) R(k +1) R(k +3) R(k +3)-R(k +2) R(k +3) R(k +3)+R(k +2) R(k +3) R(k +3)-R(k +1) JumpOnZero R(k +3), bigenough R(k +3) 0 JumpOnZero R(k +3), done bigenough: R(k +1) R(k +1)-R(k +2) Inc Rj JumpOnZero R(k +1), done JumpOnZero R(k +3), again done: R(k +1) 0 R(k +2) 0 We divide r j by l (some positive integer) by counting how many times we need to subtract l from r j before we get a remainder less than l. First we set up the calculation by copying r j into r k+1,copyingl into r k+2, and setting r j to zero (r j is our counter). Because subtraction will not give an answer less than zero we can find out if r k+1 is less than l by subtracting l = r k+2 from it and then adding l back. For example: (l =5),3 5 0and0+5 5, but thus3< 5. Hence, if r k+1 was greater than l our calculation should have left its value unchanged. So that r k+3 r k+1 0. If so, r k+1 is big enough to have a copy of l subtracted from it. Thus we subtract l and increment our counter, r j. We repeat this process until the remainder is too small (less than l). Replace Rj Rj mod l with: R(k +1) Rj R(k +1) R(k +1) l R(k +1) R(k +1) l Rj Rj - R(k +1) R(k +1) 0 Just note that the remainder is given by: Rj -[(Rj l) l]. 1.5 Conclusion Hence an arbitrary RAM uses only finitely many registers. Also, finitely many registers can be stored in a single register using prime encoding. And all instructions can be simulated using just three registers if the memory is encoded in the first register using prime encoding. Hence any RAM can be simulated by a 3-register RAM. 6

7 2 Recognizing L = {w2w w {0, 1} } Conjecture: A one-tape Turing Machine requires time O(n 2 ) to recognize the language: L = {w2w w {0, 1} } The conjecture is true. We proved in class that any Turing Machine (TM) requires at least O(n 2 ) time to recognize the language of palindromes PAL = {w {0, 1, #} w = w R }. A simple adaptation of that proof will work for the language L also. 2.1 Notation and Defining L n First, let M be a Turing Machine which recognizes the language L. Let Q be the set of states of M. (Note: obviously, any machine which reconizes L must have more than 1 state, i.e. Q > 1). If this machine accepts L, it must also accept any subset of L including: L n = {w0 n 2w0 n w {0, 1} n } Notice that w L n implies that w =4n +1 O(n). I will show that there is some element of L n which can be recognized in time no less than Ω(n 2 ). 2.2 Crossing Sequences Consider the following crossing sequences: For w L n and n j 2n, letc j (w) =(q 1,q 2,...) be an ordered list of the states that M is in when crossing between the j th and (j +1) st symbol on the tape. This list is finite since M must eventually halt and accept w. Let C(w) ={c j (w) n j 2n} (crossing sequences in the first region of 0 s in w = σ0 n 2σ0 n ). 2.3 w, x L n, w x C(w) C(x) =φ Just as in the proof from class, we can see that different elements of L n have disjoint sets of crossing sequences. Suppose that w, x L n, w x. Note that w = σ0 n 2σ0 n and w = τ0 n 2τ0 n for some σ, τ {0, 1} and because w x, wemusthavethatσ τ. Now suppose that c C(w) C(x). Then we have, for some n i, j 2n, c = c i (w) =c j (x). Let w = w w be the partition of w into the first i and the last 4n +1 i symbols. Likewise, let x = x x be the partition of x into the first j and the last (4n +1) j symbols. Now because the crossing sequences are equal, M cannot tell if it is moving out of w into w or out of x into x. The same for when it transitions back from w into w or x into x. In essence, the machine (for any given word) can be divided into two separate worlds (for any partition of the word), and if the crossing states match up for two different words (at some partition), we can paste these two different worlds together. Therefore, because M accepts w and x, it must also accept w x. Let s look at w x. For w we have n w = i 2n. Thus w = σ0 i n. 2n +1 x =(4n +1 j) 3n +1 thus x =0 2n j 2τ0 n. Therefore, w x = σ0 n+i j 2τ0 n L since even if σ0 n+i j = τ0 n 7

8 we know that σ τ hence σ0 n+i j τ0 n. Hence, M must not accept w x. This is a contradiction. Thus c = c i (w) =c j (x) cannot exist. Therefore we have proved that: w, x L n,w x C(w) C(x) =φ. 2.4 Counting Crossing Sequences Next, note that the number of crossing sequences of length k is Q k. Thus the number of crossing sequences of length at most m is (recall Q > 1): m Q i = Q m+1 1 Q 1 i=0 For each w L n we can pick out some c w C(w) such that c w = min c C(w) c (the seqence of minimal length). Now since sets of crossing sequences are disjoint we must have a distinct sequence of minimal length for each w L n. So we need at least, L n =2 n minimal length crossing sequences. Let m = max w Ln c w (this is the length of the longest minimal crossing sequence). Thus we must have: Q m+1 1 Q 1 L n =2 n Taking logs we get: m log( Q )+(some constant) log( Q m+1 1) log( Q 1) n log(2). This implies that m Ω(n). Hence there exists some element ŵ L n such that cŵ = m Ω(n) thus every crossing sequence in C(ŵ) has length at least Ω(n). Thus in order to accept ŵ, M must cross over each of the positions on the tape between the (n +1) st and (2n) th symbols at least Ω(n) times. Hence accepting ŵ L n L will take n Ω(n) time. In other words, accepting words of length Θ(n) inl can take Ω(n 2 )time. 2.5 Final Comments Actually it is easy to see that no more than O(n 2 )timeisrequiredtorecognizel. Consider the following TM: 1: Scan over the input to make sure that there is exactly one 2. If not reject, then else return to the beginning of the tape. 2: Erase the first symbol if it is 0 or 1 and remember it. If it is 2 go to step: 5. 3: Scan past all 2 s and check if the first symbol to the right of the 2 s matches. If not reject, else replace this symbol with a 2. 4: Scan back to the beginning of the tape and go back to step: 2. 5: Scan right and see if all remaining symbols are 2 s. If so accept, if not reject. Step 1 takes time O(n). Steps 2-4 take O(n) and can loop at most O(n) times. Step 5 takes time O(n). Thus this machine takes no more than 2O(n) +O(n) O(n) =O(n 2 ) time. Hence L can be recognized in time O(n 2 ) and by the previous argument we can do no better asymptotically. 8

Turing Machine Variants

Turing Machine Variants CS311 Computational Structures Turing Machine Variants Lecture 12 Andrew Black Andrew Tolmach 1 The Church-Turing Thesis The problems that can be decided by an algorithm are exactly those that can be decided

More information

Register machines L2 18

Register machines L2 18 Register machines L2 18 Algorithms, informally L2 19 No precise definition of algorithm at the time Hilbert posed the Entscheidungsproblem, just examples. Common features of the examples: finite description

More information

CpSc 421 Final Exam December 15, 2006

CpSc 421 Final Exam December 15, 2006 CpSc 421 Final Exam December 15, 2006 Do problem zero and six of problems 1 through 9. If you write down solutions for more that six problems, clearly indicate those that you want graded. Note that problems

More information

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by:

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by: Models of Computation, 2010 1 Definition Recall Register Machines A register machine (sometimes abbreviated M) is specified by: Slide 1 finitely many registers R 0, R 1,..., R n, each capable of storing

More information

Automata Theory CS S-12 Turing Machine Modifications

Automata Theory CS S-12 Turing Machine Modifications Automata Theory CS411-2015S-12 Turing Machine Modifications David Galles Department of Computer Science University of San Francisco 12-0: Extending Turing Machines When we added a stack to NFA to get a

More information

Section 20: Arrow Diagrams on the Integers

Section 20: Arrow Diagrams on the Integers Section 0: Arrow Diagrams on the Integers Most of the material we have discussed so far concerns the idea and representations of functions. A function is a relationship between a set of inputs (the leave

More information

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

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits Chris Calabro January 13, 2016 1 RAM model There are many possible, roughly equivalent RAM models. Below we will define one in the fashion

More information

Most General computer?

Most General computer? Turing Machines Most General computer? DFAs are simple model of computation. Accept only the regular languages. Is there a kind of computer that can accept any language, or compute any function? Recall

More information

Universal Turing Machine. Lecture 20

Universal Turing Machine. Lecture 20 Universal Turing Machine Lecture 20 1 Turing Machine move the head left or right by one cell read write sequentially accessed infinite memory finite memory (state) next-action look-up table Variants don

More information

Homework Assignment 6 Answers

Homework Assignment 6 Answers Homework Assignment 6 Answers CSCI 2670 Introduction to Theory of Computing, Fall 2016 December 2, 2016 This homework assignment is about Turing machines, decidable languages, Turing recognizable languages,

More information

CpSc 421 Homework 9 Solution

CpSc 421 Homework 9 Solution CpSc 421 Homework 9 Solution Attempt any three of the six problems below. The homework is graded on a scale of 100 points, even though you can attempt fewer or more points than that. Your recorded grade

More information

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

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage. Turing Machines Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage. A Turing Machine A Turing Machine (TM) has three components: An infinite tape

More information

Turing Machine Recap

Turing Machine Recap Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every

More information

Theory of Computation

Theory of Computation Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 1 / 33 Lecture 20: Overview Incompressible strings Minimal Length Descriptions Descriptive Complexity Dr. Sarmad Abbasi

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Decidability: Reduction Proofs

Decidability: Reduction Proofs Decidability: Reduction Proofs Basic technique for proving a language is (semi)decidable is reduction Based on the following principle: Have problem A that needs to be solved If there exists a problem

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 5 Reductions Undecidable problems from language theory Linear bounded automata given by Jiri Srba Lecture 5 Computability and Complexity 1/14 Reduction Informal Definition

More information

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

A Note on Turing Machine Design

A Note on Turing Machine Design CS103 Handout 17 Fall 2013 November 11, 2013 Problem Set 7 This problem explores Turing machines, nondeterministic computation, properties of the RE and R languages, and the limits of RE and R languages.

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

Boolean circuits. Lecture Definitions

Boolean circuits. Lecture Definitions Lecture 20 Boolean circuits In this lecture we will discuss the Boolean circuit model of computation and its connection to the Turing machine model. Although the Boolean circuit model is fundamentally

More information

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

Turing Machine properties. Turing Machines. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions Turing Machine properties Turing Machines TM Variants and the Universal TM There are many ways to skin a cat And many ways to define a TM The book s Standard Turing Machines Tape unbounded on both sides

More information

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

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 8 Nancy Lynch Today More undecidable problems: About Turing machines: Emptiness, etc. About

More information

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman CSE 211 Pushdown Automata CSE 211 (Theory of Computation) Atif Hasan Rahman Lecturer Department of Computer Science and Engineering Bangladesh University of Engineering & Technology Adapted from slides

More information

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

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Lecture 12: Randomness Continued

Lecture 12: Randomness Continued CS 710: Complexity Theory 2/25/2010 Lecture 12: Randomness Continued Instructor: Dieter van Melkebeek Scribe: Beth Skubak & Nathan Collins In the last lecture we introduced randomized computation in terms

More information

State Machines. Example FSM: Roboant

State Machines. Example FSM: Roboant page 1 State Machines 1) State Machine Design 2) How can we improve on FSMs? 3) Turing Machines 4) Computability Oh genie, will you now tell me what it means to compute? Doctor, I think you ve built a

More information

1 Definition of a Turing machine

1 Definition of a Turing machine Introduction to Algorithms Notes on Turing Machines CS 4820, Spring 2017 April 10 24, 2017 1 Definition of a Turing machine Turing machines are an abstract model of computation. They provide a precise,

More information

(a) Definition of TMs. First Problem of URMs

(a) Definition of TMs. First Problem of URMs Sec. 4: Turing Machines First Problem of URMs (a) Definition of the Turing Machine. (b) URM computable functions are Turing computable. (c) Undecidability of the Turing Halting Problem That incrementing

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

Turing Machines and the Church-Turing Thesis

Turing Machines and the Church-Turing Thesis CSE2001, Fall 2006 1 Turing Machines and the Church-Turing Thesis Today our goal is to show that Turing Machines are powerful enough to model digital computers, and to see discuss some evidence for the

More information

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems Valentine Kabanets September 13, 2007 1 Complexity Classes Unless explicitly stated,

More information

CSCE 551 Final Exam, Spring 2004 Answer Key

CSCE 551 Final Exam, Spring 2004 Answer Key CSCE 551 Final Exam, Spring 2004 Answer Key 1. (10 points) Using any method you like (including intuition), give the unique minimal DFA equivalent to the following NFA: 0 1 2 0 5 1 3 4 If your answer is

More information

CS 361 Meeting 26 11/10/17

CS 361 Meeting 26 11/10/17 CS 361 Meeting 26 11/10/17 1. Homework 8 due Announcements A Recognizable, but Undecidable Language 1. Last class, I presented a brief, somewhat inscrutable proof that the language A BT M = { M w M is

More information

Theory of Computation

Theory of Computation Theory of Computation Lecture #6 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 39 Lecture 6: Overview Prove the equivalence of enumerators and TMs. Dovetailing

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II Problem Set Set Five Five due due in in the the box box up up front front using using a late late day. day. Hello Hello Condensed Slide Slide Readers! Readers! This This lecture

More information

1 Acceptance, Rejection, and I/O for Turing Machines

1 Acceptance, Rejection, and I/O for Turing Machines 1 Acceptance, Rejection, and I/O for Turing Machines Definition 1.1 (Initial Configuration) If M = (K,Σ,δ,s,H) is a Turing machine and w (Σ {, }) then the initial configuration of M on input w is (s, w).

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Handicapped machines DFA limitations Tape head moves only one direction 2-way DFA

More information

Parallelism and Machine Models

Parallelism and Machine Models Parallelism and Machine Models Andrew D Smith University of New Brunswick, Fredericton Faculty of Computer Science Overview Part 1: The Parallel Computation Thesis Part 2: Parallelism of Arithmetic RAMs

More information

CSCI3390-Assignment 2 Solutions

CSCI3390-Assignment 2 Solutions CSCI3390-Assignment 2 Solutions due February 3, 2016 1 TMs for Deciding Languages Write the specification of a Turing machine recognizing one of the following three languages. Do one of these problems.

More information

Confusion of Memory. Lawrence S. Moss. Department of Mathematics Indiana University Bloomington, IN USA February 14, 2008

Confusion of Memory. Lawrence S. Moss. Department of Mathematics Indiana University Bloomington, IN USA February 14, 2008 Confusion of Memory Lawrence S. Moss Department of Mathematics Indiana University Bloomington, IN 47405 USA February 14, 2008 Abstract It is a truism that for a machine to have a useful access to memory

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.4 Explain the limits of the class of regular languages Justify why the

More information

Chapter 7 Turing Machines

Chapter 7 Turing Machines Chapter 7 Turing Machines Copyright 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 A General Model of Computation Both finite automata and pushdown automata are

More information

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

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information Theory of Computation Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University Problems and Algorithms c 2004 Prof. Yuh-Dauh

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

Modular Arithmetic Instructor: Marizza Bailey Name:

Modular Arithmetic Instructor: Marizza Bailey Name: Modular Arithmetic Instructor: Marizza Bailey Name: 1. Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find

More information

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018 Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 3. Logarithmic Space Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 3. Logarithmic Space 3.1 Computational

More information

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010 University of Virginia - cs3102: Theory of Computation Spring 2010 PS2 - Comments Average: 77.4 (full credit for each question is 100 points) Distribution (of 54 submissions): 90, 12; 80 89, 11; 70-79,

More information

MAT246H1S - Concepts In Abstract Mathematics. Solutions to Term Test 1 - February 1, 2018

MAT246H1S - Concepts In Abstract Mathematics. Solutions to Term Test 1 - February 1, 2018 MAT246H1S - Concepts In Abstract Mathematics Solutions to Term Test 1 - February 1, 2018 Time allotted: 110 minutes. Aids permitted: None. Comments: Statements of Definitions, Principles or Theorems should

More information

Turing Machine Variants. Sipser pages

Turing Machine Variants. Sipser pages Turing Machine Variants Sipser pages 148-154 Marking symbols It is often convenient to have the Turing machine leave a symbol on the tape but to mark it in some way 1 1 0 2 B B B B B B B State = 1 1 1

More information

Congruences. September 16, 2006

Congruences. September 16, 2006 Congruences September 16, 2006 1 Congruences If m is a given positive integer, then we can de ne an equivalence relation on Z (the set of all integers) by requiring that an integer a is related to an integer

More information

Asymptotic notation : big-o and small-o

Asymptotic notation : big-o and small-o Time complexity Here we will consider elements of computational complexity theory an investigation of the time (or other resources) required for solving computational problems. We introduce a way of measuring

More information

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

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture. 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

More information

Turing Machines, diagonalization, the halting problem, reducibility

Turing Machines, diagonalization, the halting problem, reducibility Notes on Computer Theory Last updated: September, 015 Turing Machines, diagonalization, the halting problem, reducibility 1 Turing Machines A Turing machine is a state machine, similar to the ones we have

More information

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010 CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010 We now embark on a study of computational classes that are more general than NP. As these classes

More information

Space Complexity. The space complexity of a program is how much memory it uses.

Space Complexity. The space complexity of a program is how much memory it uses. Space Complexity The space complexity of a program is how much memory it uses. Measuring Space When we compute the space used by a TM, we do not count the input (think of input as readonly). We say that

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II 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

More information

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

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

More information

Computation Histories

Computation Histories 208 Computation Histories The computation history for a Turing machine on an input is simply the sequence of configurations that the machine goes through as it processes the input. An accepting computation

More information

Decidable Languages - relationship with other classes.

Decidable Languages - relationship with other classes. CSE2001, Fall 2006 1 Last time we saw some examples of decidable languages (or, solvable problems). Today we will start by looking at the relationship between the decidable languages, and the regular and

More information

Turing Machines. Chapter 17

Turing Machines. Chapter 17 Turing Machines Chapter 17 Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing Machines Grammars, SD Languages, and Turing Machines

More information

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

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012 Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM

More information

Turing Machine variants

Turing Machine variants Turing Machine variants We extend the hardware of our Turing Machine.. + 2-way infinite tape (M±) ++ more than one tape (M 2, M 3..) +++ 2-dimensional tape and explore Church s thesis....if it is true,

More information

Turing Machines Part Two

Turing Machines Part Two Turing Machines Part Two Recap from Last Time Our First Turing Machine q acc a start q 0 q 1 a This This is is the the Turing Turing machine s machine s finiteisttiteiconntont. finiteisttiteiconntont.

More information

where Q is a finite set of states

where Q is a finite set of states Space Complexity So far most of our theoretical investigation on the performances of the various algorithms considered has focused on time. Another important dynamic complexity measure that can be associated

More information

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...} WORKSHEET ON NUMBERS, MATH 215 FALL 18(WHYTE) We start our study of numbers with the integers: Z = {..., 2, 1, 0, 1, 2, 3,... } and their subset of natural numbers: N = {1, 2, 3,...} For now we will not

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

Theory of Computation Lecture Notes

Theory of Computation Lecture Notes Theory of Computation Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University c 2008 Prof. Yuh-Dauh Lyuu, National Taiwan

More information

Non-emptiness Testing for TMs

Non-emptiness Testing for TMs 180 5. Reducibility The proof of unsolvability of the halting problem is an example of a reduction: a way of converting problem A to problem B in such a way that a solution to problem B can be used to

More information

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

More Turing Machines. CS154 Chris Pollett Mar 15, 2006. More Turing Machines CS154 Chris Pollett Mar 15, 2006. Outline Multitape Turing Machines Nondeterministic Turing Machines Enumerators Introduction There have been many different proposals for what it means

More information

9.2 Multiplication Properties of Radicals

9.2 Multiplication Properties of Radicals Section 9.2 Multiplication Properties of Radicals 885 9.2 Multiplication Properties of Radicals Recall that the equation x 2 = a, where a is a positive real number, has two solutions, as indicated in Figure

More information

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

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages 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

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

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

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 Computational complexity studies the amount of resources necessary to perform given computations.

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1 U.C. Berkeley CS278: Computational Complexity Handout N1 Professor Luca Trevisan August 30, 2004 Notes for Lecture 1 This course assumes CS170, or equivalent, as a prerequisite. We will assume that the

More information

The trick is to multiply the numerator and denominator of the big fraction by the least common denominator of every little fraction.

The trick is to multiply the numerator and denominator of the big fraction by the least common denominator of every little fraction. Complex Fractions A complex fraction is an expression that features fractions within fractions. To simplify complex fractions, we only need to master one very simple method. Simplify 7 6 +3 8 4 3 4 The

More information

Theory of Computation

Theory of Computation Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 1 / 38 Lecture 21: Overview Big-Oh notation. Little-o notation. Time Complexity Classes Non-deterministic TMs The Class

More information

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015 Undecidability and Rice s Theorem Lecture 26, December 3 CS 374, Fall 2015 UNDECIDABLE EXP NP P R E RECURSIVE Recap: Universal TM U We saw a TM U such that L(U) = { (z,w) M z accepts w} Thus, U is a stored-program

More information

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine Samuel C. Hsieh Computer Science Department, Ball State University July 3, 2014 Abstract We establish a lower

More information

Introduction to Computer Science and Programming for Astronomers

Introduction to Computer Science and Programming for Astronomers Introduction to Computer Science and Programming for Astronomers Lecture 8. István Szapudi Institute for Astronomy University of Hawaii March 7, 2018 Outline Reminder 1 Reminder 2 3 4 Reminder We have

More information

Turing Machines Part III

Turing Machines Part III Turing Machines Part III Announcements Problem Set 6 due now. Problem Set 7 out, due Monday, March 4. Play around with Turing machines, their powers, and their limits. Some problems require Wednesday's

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 4.2 Trace high-level descriptions of algorithms for computational problems. Use

More information

Advanced topic: Space complexity

Advanced topic: Space complexity Advanced topic: Space complexity CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2016 1/28 Review: time complexity We have looked at how long it takes to

More information

Limits of Feasibility. Example. Complexity Relationships among Models. 1. Complexity Relationships among Models

Limits of Feasibility. Example. Complexity Relationships among Models. 1. Complexity Relationships among Models Limits of Feasibility Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at 1. Complexity

More information

Computability Theory. CS215, Lecture 6,

Computability Theory. CS215, Lecture 6, Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David

More information

Week 2: Defining Computation

Week 2: Defining Computation Computational Complexity Theory Summer HSSP 2018 Week 2: Defining Computation Dylan Hendrickson MIT Educational Studies Program 2.1 Turing Machines Turing machines provide a simple, clearly defined way

More information

Introduction to Languages and Computation

Introduction to Languages and Computation Introduction to Languages and Computation George Voutsadakis 1 1 Mathematics and Computer Science Lake Superior State University LSSU Math 400 George Voutsadakis (LSSU) Languages and Computation July 2014

More information

Chapter 2 INTEGERS. There will be NO CALCULATORS used for this unit!

Chapter 2 INTEGERS. There will be NO CALCULATORS used for this unit! Chapter 2 INTEGERS There will be NO CALCULATORS used for this unit! 2.2 What are integers? 1. Positives 2. Negatives 3. 0 4. Whole Numbers They are not 1. Not Fractions 2. Not Decimals What Do You Know?!

More information

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes Complexity Theory 1 Complexity Theory 2 Complexity Theory Lecture 3 Complexity For any function f : IN IN, we say that a language L is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Nachum Dershowitz & Yishay Mansour. Tel Aviv University. May 17 22, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan 9/6/2004. Notes for Lecture 3

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan 9/6/2004. Notes for Lecture 3 U.C. Berkeley CS278: Computational Complexity Handout N3 Professor Luca Trevisan 9/6/2004 Notes for Lecture 3 Revised 10/6/04 1 Space-Bounded Complexity Classes A machine solves a problem using space s(

More information

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6 Math 131 notes Jason Riedy 6 October, 2008 Contents 1 Modular arithmetic 2 2 Divisibility rules 3 3 Greatest common divisor 4 4 Least common multiple 4 5 Euclidean GCD algorithm 5 6 Linear Diophantine

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. May 11/13, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

4.2 The Halting Problem

4.2 The Halting Problem 172 4.2 The Halting Problem The technique of diagonalization was discovered in 1873 by Georg Cantor who was concerned with the problem of measuring the sizes of infinite sets For finite sets we can simply

More information

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 CS 373: Theory of Computation Sariel Har-Peled and Madhusudan Parthasarathy Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 This lecture covers Rice s theorem, as well as

More information

MACHINE COMPUTING. the limitations

MACHINE COMPUTING. the limitations MACHINE COMPUTING the limitations human computing stealing brain cycles of the masses word recognition: to digitize all printed writing language education: to translate web content games with a purpose

More information

Computability Theory

Computability Theory Computability Theory Cristian S. Calude and Nicholas J. Hay May June 2009 Computability Theory 1 / 155 1 Register machines 2 Church-Turing thesis 3 Decidability 4 Reducibility 5 A definition of information

More information