Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Size: px
Start display at page:

Download "Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject."

Transcription

1 Turing Machines Transducers: A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating the input symbol and the other designating the output symbol. The two symbols are written with a slash,/, separating them. When an FST computes on an input string w, it takes the input symbols w 1, w n one by one and, starting at the start state, follows the transitions by matching the input labels with the sequence of symbols w1,..wn. Every time it goes along a transition, it outputs the corresponding output symbol. 0/0 1/0 2/1 1/1 2/1 q1f q2 0/0 For example, on input ( ) Formal Definition of the finite state transducer: A transducer finite state machine is a 5-tuple (Q,, Γ,δ, q0) where: Q is a finite non empty set of states is the input alphabet Γ is the output alphabet q0 is the start state, an element of Q δ is the state transition function: δ: Q x Q x Γ Turing Machines

2 A Turing machine is like a pushdown automaton. Both have a finite-state machine as a central component; both have additional storage. But where a pushdown automaton uses a stack for storage, a Turing machine uses a tape, which is considered to be infinite in both directions. The tape consists of a series of squares, each of which can hold a single symbol. The tape head, or read-write head, can read a symbol from the tape, write a symbol to the tape, and move one square in either direction. Turing machines can be deterministic or nondeterministic. We will consider only deterministic machines. Unlike the other automata we have discussed, a Turing machine does not read "input." Instead, there may be (and usually are) symbols on the tape before the Turing machine begins; the Turing machine might read some, all, or none of these symbols. The initial tape may, if desired, be thought of as "input." The following list summarizes the differences between FSA and Turing machines: A Turing machine can both write on the tape and read from it. A read-write head can move both to the left and to the right the tape is infinite The special states for rejecting and accepting take effect immediately. Let us introduce a Turing machine M1 for recognizing the language B= { w#w w {0,1}* We want M1 to accept if its input is a member of B or reject otherwise. An input is a member of B if it consists of two identical strings separated by a # symbol. The input is too long to remember it all, but the machine is allowed to move back and forth over the input and make marks on it. Strategy: Read each symbol on the two sides of the # and determine whether they match. Place marks on the tape to keep track of which places they correspond. M1 will take multiple passes over the input string with the read/write head. On each pass it matches one of characters on each side of the # symbol, To keep track of which symbols have been checked already, M1 crosses off each symbol as it is examined. If it crosses off all the symbols, that means that everything matched successfully and M1 goes into an accept state. If it discovers a mismatch, it enters the reject state. Formal Definition of Turing Machines

3 A Turing machine M is a 7-tuple (Q,,,, q 0, #, F) where Q is a set of states, is a finite set of symbols, the input alphabet, is a finite set of symbols, the tape alphabet, is the partial transition function, # is a symbol called blank, q 0 Q is the initial state, F Q is a set of final states. M= (Q,, Γ, δ, q0, B, F), whose components have the following meaning: Q: The finite set of states of the machine : The finite set of input symbols Γ: The complete set of tape symbols; δ: the transition function. The arguments of δ(q, X) are a state q and a tape symbol X. The value of δ(q, X), if it is defined, is a triple (p, Y, D) where: 1. p is the next state in Q 2. Y is the symbol, in Γ, written in the cell being scanned, replacing whatever symbol was there. 3. D is the direction, either L or R, standing for left or right, respectively and telling us the direction in which the head moves. q0: The start state a member of Q, in which the machine is found initially B: The blank symbol. This symbol is in Γ but not in F: The set of final or accepting states; a subset of Q. Because the Turing machine has to be able to find its input, and to know when it has processed all of that input, we require: The tape is initially blank (every symbol is #) except possibly for a finite, contiguous sequence of symbols. If there are initially nonblank symbols on the tape, the tape head is initially positioned on one of them.

4 There is a distinction between (the input alphabet) and (the tape alphabet). The "input" (the nonblank symbols on the tape) does not contain # or blank. However the complete set of tape symbols includes # or blanks. Usually is a subset of Transition Function, Instantaneous Descriptions, and Moves The transition function for Turing machines is given by : Q Q {L, R} This means: When the machine is in a given state (q Q) and reads a given symbol (t ) from the tape, it replaces the symbol on the tape with some other symbol (t ), goes to some other state (q Q), and moves the tape head one square left (L) or right (R). An instantaneous description or configuration of a Turing machine requires (1) the state the Turing machine is in, (2) the contents of the tape, and (3) the position of the tape head on the tape. This can be summarized in a string of the form x i...x j q m x k...x l where the x's are the symbols on the tape, q m is the current state, and the tape head is on the square containing x k (the symbol immediately following q m ). A move of a Turing machine can therefore be represented as a pair of instantaneous descriptions, separated by the symbol " ". For example, if (q 5, b) = (q 8, c, R) then a possible move might be abbabq 5 babb abbabcq 8 abb Programming a Turing Machine Just as the productions are the "heart" of a grammar, in that most of the other components can be figured out by looking at the productions, the transitions are the heart of a Turing machine. These transitions are often given as a table or list of 5-tuples, where each tuple has the form (current state, symbol read, symbol written, direction, next state) Creating such a list is often spoken of as "programming" a Turing machine. A Turing machine is often defined to start with the read head positioned over the first (leftmost) input symbol. This isn't really necessary, because if the Turing machine starts anywhere on the nonblank portion of the tape, it's simple to get to the first input symbol.

5 For the input alphabet = {a, b}, the following program fragment positions the head on the leftmost symbol and moves right to q 1 : (q0, a, a, L, q0) (q0, b, b, L, q0) (q0, #, #, R, q1) If we start a Turing machine on an input, three outcomes are possible: 1. The machine may accept, 2. The machine may reject or 3. The machine may loop. By loop we mean that the machine does not halt. A Turing machine halts when it no longer has any available moves. If a Turing Machine (TM) halts in a final state, it accepts its input; otherwise, it rejects its input. If a Turing machine halts, the sequence of configurations leading to the halt state is called a computation. Failed computations: ATuring machine accepts its input if it halts in a final state. There are two ways this could fail to happen: 1. The Turing machine could halt in a nonfinal state, or 2. The Turing machine could never stop (in which case we say it is in an infinite loop. ) A function f is Turing computable if there exist a Turing machine that can perform it. Describe a Turing machine (TM) M that decides A={0 2n n>=0}. Example of strings: 0, 00, 0000, Current State Symbol Read Symbol written direction next state q1 ^ ^ R q reject q1 x x R q reject q1 0 ^ R q2 q2 x x R q2 q2 0 x R q3 q2 ^ ^ R q accept q3 x x R q3 q3 ^ ^ L q5 q3 0 0 R q4 q4 0 x R q3 q4 x x R q4

6 q4 ^ ^ R q reject q5 0 0 L q5 q5 x x L q5 q5 ^ ^ R q2 find its computation on input 0000 q ; ^q 2 000; ^xq 3 00; ^x0q 4 0; ^x0xq 3^; ^x0q 5 x^; ^xq 5 0x^; ^q 5 x0x^,. Define a Turing machine that recognizes strings of the form {0 n 1 n n>=1} Initially it is given a finite sequence of 0 s and 1 s on its tape, preceded and followed by an infinite number of blanks. How would this machine proceed? Starting at the left end of the input, it changes a 0 into an x. It moves to the right over whatever 0 s and y s it sees until it comes to a 1. It changes the 1 to a y It moves left over 0 s and y s until it finds an x. At this point it looks for a 0 immediately to the right, and if it finds one, changes it into an x and repeat the process, changing a matching 1 to y. M= ({q0,q1,q2,q3,q4},{0,1},{0,1,x,y,^}, δ, q0,^,{q4}) As M performs its computation, the portion of the tape, that the head has visited will always be a sequence of symbols described by the regular expression x*0*y*1*. - Write the function δ. - Check that it accepts Check that it rejects 0010 Transition diagrams for Turing Machines: The same as for PDA a TM can be represented with a diagram. A transition diagram consists of: - set of nodes corresponding to the states of the TM. - An arc from state q to state p is labeled by one or more items of the form X/YD, where X and Y are tape symbols, and D is a direction, either L or R. That is, whenever δ(q,x)=(p,y,d), we find the label X/YD on the arc from q to p. - The start and final states representations follow the same conventions as for other kinds of transition diagrams.

7 Represent the transition diagram for the TM that accepts {0 n 1 n } Languages and Turing Machines Definition: A Turing Machine T = (Q,,,, q 0, #, F) accepts a language L(M), where : L(M) = {w + : q 0 w x i q f x j for some q f F, x i, x j *} The set of languages that we can accept using a Turing machine is often called recursively enumerable languages or RE languages. A language is Turing-recognizable if some Turing machine recognizes it. Turing Machines and Halting: Acceptance by halting: We say that a TM halts if it enters a state q, scanning a tape symbol x and there is no move in this situation; i.e.; the transition function is undefined. In general, we assume that a TM always halts when it is in an accepting state. Languages with TM that eventually halt whether they accept or not are called recursive. TM that always halt, regardless of whether or not they accept, are good model of an algorithm. That is if an algorithm to solve a given problem exists, then we say the problem is decidable. A language is Turing-decidable or decidable if some Turing decides it. machine Variants of Turing Machines: -Storage in the State: We can use the control not only to represent the state of the machine but also a finite amount of data. In that sense, a state is represented as pairs with two components: a) a control portion q i that remembers what the TM is doing. b) a data portion, which remembers what symbol has been seen.

8 -Multiple Tracks: We can think of the tape of a Turing machine as composed of several tracks. Each track can hold one symbol and the tape alphabet of the TM consists of tuples, with one component for each track. A common use of multiple tracks is to treat one track as holding the data and a second track as holding a mark. We can check off each symbol as we use it or we can keep track of a small number of positions. Example: Design a TM that recognizes the non-context free language: L wcw = {wcw w is in (0+1) + } The TM is defined as: M= (Q,, Γ, δ,[q1,^],[^,^],{[q9,^]}) where: Q: The set of states is {q0, q1,, q9} x {0,1, ^}, that is, pairs consisting of a control state qi and a data component: 0, 1, and ^ (for blank). Γ: The set of tape symbols is {^, *} x {0,1, c, ^}. The first component, or track, can be either blank or checked represented by the symbols ^ and *, respectively. We use the * to check off symbols of the first and second groups of 0 s and 1 s, eventually confirming that the string to the left of the center marker c is the same as the string to its right. The second component of the tape symbol is the tape symbol itself. -Multitape Turing Machines: A multitape Turing machine is like an ordinary Turing machine with several tapes. Each tape has its own head for reading and writing. Initially the input appears on tape 1, and the others start out blank. The transition function is changed to allow for reading, writing and moving the heads on some or all of the tapes simultaneously..formally, the transition function is: δ: Q x Γ k Q x Γ k x {L, R, S} k where k is the number of tapes. The expression δ(q i,a 1,.a k )= (q j, b 1,..,b k, L, R,..,L) means that, if the machine is in state q i and the heads 1 through k are reading symbols a 1,.a k ; the machine goes to state q j, writes symbols b 1,..,b k and directs each head to move left or right or to stay stationary, as specified. Theorem: Every language accepted by a multitape TM is recursively enumerable. Theorem: Every multitape Turing machine has an equivalent single-tape Turing machine. Proof: We have to convert a multitape TM M to an equivalent single-tape TM S.

9 Say that M has k tapes, then S simulates the effect of k tapes by storing their information on its single tape. It uses the new symbol # as a delimiter to separate the contents of the different tapes. In addition, S must keep track of the locations of the heads. It does so by writing a tape symbol with a dot above it to mark where the head on that tape would be. The dotted symbols are simply new symbols that have been added to the tape alphabet. M ^ a a a ^ b a ^ S # # a a a # b a # ^.. Representing three tapes with one Non deterministic Turing machines: A nondeterministic TM is defined such as at any point in a computation the machine may proceed according to several possibilities. The transition function of a nondeterministic TM has the form: δ:q x Γ P(Q x Γ x {L, R}). The computation of a non-deterministic TM is a tree whose branches correspond to different possibilities for the machine. -If some branch of the computation leads to the accept state, the machine accepts its input. Theorem: Every nondeterministic Turing Machine has an equivalent deterministic Turing Machine. Corollary:

10 A language is Turing-recognizable if and only if some nondeterministic Turing machine recognizes it. Decider: We call a nondetermistic Turing machine a decider of all branches halt on all inputs. Corollary: A language is decidable if and only if some nondeterministic Turing machine decides it. Enumerators: An enumerator is a TM with an attached printer. The TM can use that printer as an output device. Every time the TM wants to add a string to the list, it sends the string to the printer. The language enumerated by E is the collection of all the strings that it eventually prints out. E may generate the strings of the language in any order with possible repetitions. Theorem: A language is Turing recognizable if and only if some enumerator enumerates it. Equivalence with other models Many models of general purpose computation have been proposed. All these models share the essential feature of TM- namely unrestricted access to unlimited memorydistinguishing them from weaker models such as FSA and PDA. All models with that feature are equivalent in power. Turing Machines and Computers: Computers and Turing Machines accept exactly the same languages- the recursively enumerable languages. 1. A computer can simulate a Turing machine 2. A Turing machine can simulate a computer, and can do so in an amount of time that is at most polynomial in the number of steps taken by the computer. Simulating a computer by a Turing Machine: This is done by assuming that the computer storage consists of an indefinitely long sequence of words, each with an address that is an integer. We assume that the program of the computer is stored in some of the memory. We assume that each instruction involves a finite number of words and that each instruction changes the value of at most one word. This can be simulated using a Turing machine consisting of multiple tapes. The first tape represents the entire memory of the computer. The second tape is the instruction counter etc.. Simulating a Turing machine by a computer:

11 In order to simulate the infinite memory of a Turing machine, we assume that our computer has an infinite number of disks that are swapped one a disk become full. Furthermore, we assume that the data on the tape can be simulated by disks arranged in two stacks. One stack holds the data in the TM located significantly to the left and the other holds the data, located significantly to the right. When the head moves sufficiently far to the left or right so as it reaches cells not represented by the disk currently mounted in the computer, it issues a swap message.

Variants of Turing Machines

Variants of Turing Machines November 4, 2013 Robustness Robustness Robustness of a mathematical object (such as proof, definition, algorithm, method, etc.) is measured by its invariance to certain changes Robustness Robustness of

More information

Theory of Languages and Automata

Theory of Languages and Automata Theory of Languages and Automata Chapter 3- The Church-Turing Thesis Sharif University of Technology Turing Machine O Several models of computing devices Finite automata Pushdown automata O Tasks that

More information

ECS 120 Lesson 16 Turing Machines, Pt. 2

ECS 120 Lesson 16 Turing Machines, Pt. 2 ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their

More information

Introduction to Computers & Programming

Introduction to Computers & Programming 16.070 Introduction to Computers & Programming Theory of computation 5: Reducibility, Turing machines Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT States and transition function State control A finite

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Turing machines Professor Daniel Leeds dleeds@fordham.edu JMH 332 Alan Turing (1912-1954) Father of Theoretical Computer Science Key figure in Artificial Intelligence Codebreaker

More information

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function TAFL 1 (ECS-403) Unit- V 5.1 Turing Machine 5.2 TM as computer of Integer Function 5.2.1 Simulating Turing Machine by Computer 5.2.2 Simulating Computer by Turing Machine 5.3 Universal Turing Machine 5.4

More information

Outline. Language Hierarchy

Outline. Language Hierarchy Outline Language Hierarchy Definition of Turing Machine TM Variants and Equivalence Decidability Reducibility Language Hierarchy Regular: finite memory CFG/PDA: infinite memory but in stack space TM: infinite

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 9 January 26, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis decidable, RE, co-re languages Deciding and Recognizing

More information

Equivalence of NTMs and TMs

Equivalence of NTMs and TMs Equivalence of NTMs and TMs What is a Turing Machine? Similar to a finite automaton, but with unlimited and unrestricted memory. It uses an infinitely long tape as its memory which can be read from and

More information

pp Variants of Turing Machines (Sec. 3.2)

pp Variants of Turing Machines (Sec. 3.2) pp. 176-176-182. Variants of Turing Machines (Sec. 3.2) Remember: a language is Turing recognizable if some TM accepts it. Adding features may simplify programmability but DO NOT affect what a TM can compute.

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Today's learning goals Sipser sec 3.2 Describe several variants of Turing machines and informally explain why they

More information

CT32 COMPUTER NETWORKS DEC 2015

CT32 COMPUTER NETWORKS DEC 2015 Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing Turing Machines A Turing machine is similar to a finite automaton with supply of unlimited memory. A Turing machine can do everything that any computing device can do. There exist problems that even a

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 2, 3.1 State and use the Church-Turing thesis. Describe several variants of Turing

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.2, 3.3 Define variants of TMs Enumerators Multi-tape TMs Nondeterministic TMs

More information

Enumerations and Turing Machines

Enumerations and Turing Machines Enumerations and Turing Machines Mridul Aanjaneya Stanford University August 07, 2012 Mridul Aanjaneya Automata Theory 1/ 35 Finite Sets Intuitively, a finite set is a set for which there is a particular

More information

Turing Machines, continued

Turing Machines, continued Previously: Turing Machines, continued CMPU 240 Language Theory and Computation Fall 2018 Introduce Turing machines Today: Assignment 5 back TM variants, relation to algorithms, history Later Exam 2 due

More information

Actually talking about Turing machines this time

Actually talking about Turing machines this time Actually talking about Turing machines this time 10/25/17 (Using slides adapted from the book) Administrivia HW due now (Pumping lemma for context-free languages) HW due Friday (Building TMs) Exam 2 out

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

More information

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007. Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 D E C I D A B I L I T Y 4 Objectives 5 Objectives investigate the power of algorithms to solve problems.

More information

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE

More information

A Characterization of the Chomsky Hierarchy by String Turing Machines

A Characterization of the Chomsky Hierarchy by String Turing Machines A Characterization of the Chomsky Hierarchy by String Turing Machines Hans W. Lang University of Applied Sciences, Flensburg, Germany Abstract A string Turing machine is a variant of a Turing machine designed

More information

Theory of Computation, Homework 3 Sample Solution

Theory of Computation, Homework 3 Sample Solution Theory of Computation, Homework 3 Sample Solution 3.8 b.) The following machine M will do: M = "On input string : 1. Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found,

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

Turing Machine Languages

Turing Machine Languages Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

More information

Theory of Programming Languages COMP360

Theory of Programming Languages COMP360 Theory of Programming Languages COMP360 Sometimes it is the people no one imagines anything of, who do the things that no one can imagine Alan Turing What can be computed? Before people even built computers,

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Turing Machines CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Chapter 14: Pushdown Automata

Chapter 14: Pushdown Automata Chapter 14: Pushdown Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu The corresponding textbook chapter should

More information

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207 Name: 1 a 20 b 20 c 20 d 20 e 20 f 20 g 20 2 10 3 30 4 12 5 15 Total 207 CS 341 Practice Final Exam 1. Please write neatly. You will lose points if we cannot figure out what you are saying. 2. Whenever

More information

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG) CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

More information

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

More information

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

I have read and understand all of the instructions below, and I will obey the Academic Honor Code. Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2014, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

More information

Nondeterministic Finite Automata (NFA): Nondeterministic Finite Automata (NFA) states of an automaton of this kind may or may not have a transition for each symbol in the alphabet, or can even have multiple

More information

Decidable Problems. We examine the problems for which there is an algorithm.

Decidable Problems. We examine the problems for which there is an algorithm. Decidable Problems We examine the problems for which there is an algorithm. Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always

More information

Turing Machine as Transducer. Turing Machines. Computation with Turing Machines. Computation with Turing Machines. Computation with Turing Machines

Turing Machine as Transducer. Turing Machines. Computation with Turing Machines. Computation with Turing Machines. Computation with Turing Machines Turing Machine as Transducer Turing Computation and programming Transducer -- any device that converts a signal from one form to another Turning machine Converts input to output Start with string on the

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

Multiple Choice Questions

Multiple Choice Questions Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

More information

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

More information

(Refer Slide Time: 0:19)

(Refer Slide Time: 0:19) Theory of Computation. Professor somenath Biswas. Department of Computer Science & Engineering. Indian Institute of Technology, Kanpur. Lecture-15. Decision Problems for Regular Languages. (Refer Slide

More information

Lec-5-HW-1, TM basics

Lec-5-HW-1, TM basics Lec-5-HW-1, TM basics (Problem 0)-------------------- Design a Turing Machine (TM), T_sub, that does unary decrement by one. Assume a legal, initial tape consists of a contiguous set of cells, each containing

More information

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. Other Automata We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. From all of this information we decide what state

More information

PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)

PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3) CS 573 Automata Theory and Formal Languages Professor Leslie Lander Lecture # 20 November 13, 2000 Greibach Normal Form (GNF) Sheila Greibach s normal form (GNF) for a CFG is one where EVERY production

More information

COMP 382: Reasoning about algorithms

COMP 382: Reasoning about algorithms Spring 2015 Unit 2: Models of computation What is an algorithm? So far... An inductively defined function Limitation Doesn t capture mutation of data Imperative models of computation Computation = sequence

More information

UNIT I PART A PART B

UNIT I PART A PART B OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

More information

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson Lecture 7: Primitive Recursion is Turing Computable Michael Beeson Closure under composition Let f and g be Turing computable. Let h(x) = f(g(x)). Then h is Turing computable. Similarly if h(x) = f(g 1

More information

Lecture 18: Turing Machines

Lecture 18: Turing Machines Lecture 18: Turing Machines Some Languages are not Context-Free At the end of the last section, we used the Pumping Lemma for Context Free Languages to prove that there are languages that are not context

More information

Context Free Languages and Pushdown Automata

Context Free Languages and Pushdown Automata Context Free Languages and Pushdown Automata COMP2600 Formal Methods for Software Engineering Ranald Clouston Australian National University Semester 2, 2013 COMP 2600 Context Free Languages and Pushdown

More information

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

More information

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final Exam Solutions 1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try

More information

1 Parsing (25 pts, 5 each)

1 Parsing (25 pts, 5 each) CSC173 FLAT 2014 ANSWERS AND FFQ 30 September 2014 Please write your name on the bluebook. You may use two sides of handwritten notes. Perfect score is 75 points out of 85 possible. Stay cool and please

More information

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES * ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES * Pradip Peter Dey, Mohammad Amin, Bhaskar Raj Sinha and Alireza Farahani National University 3678 Aero Court San Diego, CA 92123 {pdey, mamin,

More information

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2 6.045J/18.400J: Automata, omputability and omplexity March 21, 2007 Practice Quiz 2 Prof. Nancy Lynch Elena Grigorescu Please write your name in the upper corner of each page. INFORMATION ABOUT QUIZ 2:

More information

Limited Automata and Unary Languages

Limited Automata and Unary Languages Limited Automata and Unary Languages Giovanni Pighizzini and Luca Prigioniero Dipartimento di Informatica, Università degli Studi di Milano, Italy {pighizzini,prigioniero}@di.unimi.it Abstract. Limited

More information

The Big Picture. Chapter 3

The Big Picture. Chapter 3 The Big Picture Chapter 3 Examining Computational Problems We want to examine a given computational problem and see how difficult it is. Then we need to compare problems Problems appear different We want

More information

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study groups. Please prove

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

Final Course Review. Reading: Chapters 1-9

Final Course Review. Reading: Chapters 1-9 Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars

More information

CS 125 Section #4 RAMs and TMs 9/27/16

CS 125 Section #4 RAMs and TMs 9/27/16 CS 125 Section #4 RAMs and TMs 9/27/16 1 RAM A word-ram consists of: A fixed set of instructions P 1,..., P q. Allowed instructions are: Modular arithmetic and integer division on registers; the standard

More information

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language CSCI 2400 Models of Computation, Section 3 Solutions to Practice Final Exam Here are solutions to the practice final exam. For some problems some details are missing for brevity. You should write complete

More information

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

More information

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course) *4459255* [4459] 255 Seat No. T.E. (Computer Engineering) (Semester I) Examination, 2013 THEY OF COMPUTATION (2008 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Answers to the two Sections

More information

Theory of Computations Spring 2016 Practice Final

Theory of Computations Spring 2016 Practice Final 1 of 6 Theory of Computations Spring 2016 Practice Final 1. True/False questions: For each part, circle either True or False. (23 points: 1 points each) a. A TM can compute anything a desktop PC can, although

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010 CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010 Andrej Bogdanov The Church-Turing thesis states that the Turing Machine is as capable as any realistic

More information

lec3:nondeterministic finite state automata

lec3:nondeterministic finite state automata lec3:nondeterministic finite state automata 1 1.introduction Nondeterminism is a useful concept that has great impact on the theory of computation. When the machine is in a given state and reads the next

More information

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/

More information

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ. CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every

More information

Decision Properties for Context-free Languages

Decision Properties for Context-free Languages Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment

More information

Final Exam 1, CS154. April 21, 2010

Final Exam 1, CS154. April 21, 2010 Final Exam 1, CS154 April 21, 2010 Exam rules. The exam is open book and open notes you can use any printed or handwritten material. However, no electronic devices are allowed. Anything with an on-off

More information

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman And Introduction to Languages and The by J. C. Martin Basic Mathematical

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Section 2.2 Define push-down automata informally and formally Trace the computation

More information

Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

More information

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is Does this program exist? For example, if the string program is Limits of computability public void abc(string s) { if( s == "abc" ) { print "Hello world!"; } else { print "Whatever"; }} then test called

More information

Languages and Models of Computation

Languages and Models of Computation Computer Science 52 Languages and Models of Computation Spring Semester, 2018 Computer scientists use languages in (at least) two ways. They design and use programming languages, and they study formal

More information

Log-Space. A log-space Turing Machine is comprised of two tapes: the input tape of size n which is cannot be written on, and the work tape of size.

Log-Space. A log-space Turing Machine is comprised of two tapes: the input tape of size n which is cannot be written on, and the work tape of size. CSE 431 Theory of Computation Scribes: Michelle Park and Julianne Brodhacker Lecture 18 May 29 Review of Log-Space Turing Machines: Log-Space A log-space Turing Machine is comprised of two tapes: the input

More information

More on Polynomial Time and Space

More on Polynomial Time and Space CpSc 8390 Goddard Fall15 More on Polynomial Time and Space 20.1 The Original NP-Completeness Proof A configuration/snapshot of a machine is a representation of its current state (what info would be needed

More information

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 1. Turing Machines A Turing machine (TM) consists of (Turing 1936): Alan Turing 1. An unbounded tape. Divided into squares,

More information

More Simulations. CS154 Chris Pollett Apr 25, 2007.

More Simulations. CS154 Chris Pollett Apr 25, 2007. More Simulations CS154 Chris Pollett Apr 25, 2007. Outline Multi-tape Turing Machines RAMS k-tape Turing Machine One way you might try to improve the power of a TM is to allow multiple tapes. Definition

More information

CS 44 Exam #2 February 14, 2001

CS 44 Exam #2 February 14, 2001 CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the

More information

Specifying Syntax COMP360

Specifying Syntax COMP360 Specifying Syntax COMP360 The most important thing in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking

More information

III. Supplementary Materials

III. Supplementary Materials III. Supplementary Materials The Three Hour Tour Through Automata Theory Analyzing Problems as Opposed to Algorithms In CS336 you learned to analyze algorithms. This semester, we're going to analyze problems.

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

Theory of Computation

Theory of Computation Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

More information

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

More information

To illustrate what is intended the following are three write ups by students. Diagonalization

To illustrate what is intended the following are three write ups by students. Diagonalization General guidelines: You may work with other people, as long as you write up your solution in your own words and understand everything you turn in. Make sure to justify your answers they should be clear

More information

CSC-461 Exam #2 April 16, 2014

CSC-461 Exam #2 April 16, 2014 Pledge: On my honor, I pledge that I have not discussed any of the questions on this exam with fellow students, nor will I until after 7 p.m. tonight. Signed: CSC-461 Exam #2 April 16, 2014 Name Time Started:

More information

Verification in Loosely Synchronous Queue-Connected Discrete Timed Automata

Verification in Loosely Synchronous Queue-Connected Discrete Timed Automata Verification in Loosely Synchronous Queue-Connected Discrete Timed Automata Oscar H. Ibarra, Zhe Dang and Pierluigi San Pietro Department of Computer Science University of California, Santa Barbara, CA

More information

Chapter 4 Turing Machines

Chapter 4 Turing Machines Chapter 4 Turing Machines Alan Turing completed the invention of what became known as Turing Machines in 1936. He was seeking to describe in a precise way what it means to systematically calculate or compute.

More information

1.0 Languages, Expressions, Automata

1.0 Languages, Expressions, Automata .0 Languages, Expressions, Automata Alphaet: Language: a finite set, typically a set of symols. a particular suset of the strings that can e made from the alphaet. ex: an alphaet of digits = {-,0,,2,3,4,5,6,7,8,9}

More information

Formal languages and computation models

Formal languages and computation models Formal languages and computation models Guy Perrier Bibliography John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman - Introduction to Automata Theory, Languages, and Computation - Addison Wesley, 2006.

More information

Languages and Compilers

Languages and Compilers Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 3. Formal Languages, Grammars and Automata Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office:

More information

Formal Grammars and Abstract Machines. Sahar Al Seesi

Formal Grammars and Abstract Machines. Sahar Al Seesi Formal Grammars and Abstract Machines Sahar Al Seesi What are Formal Languages Describing the sentence structure of a language in a formal way Used in Natural Language Processing Applications (translators,

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

Material from Recitation 1

Material from Recitation 1 Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing

More information

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued CD5080 AUBER odels of Computation, anguages and Automata ecture 14 älardalen University Content Universal Turing achine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Decidability

More information

Final Exam 2, CS154. April 25, 2010

Final Exam 2, CS154. April 25, 2010 inal Exam 2, CS154 April 25, 2010 Exam rules. he exam is open book and open notes you can use any printed or handwritten material. However, no electronic devices are allowed. Anything with an on-off switch

More information

A Note on the Succinctness of Descriptions of Deterministic Languages

A Note on the Succinctness of Descriptions of Deterministic Languages INFORMATION AND CONTROL 32, 139-145 (1976) A Note on the Succinctness of Descriptions of Deterministic Languages LESLIE G. VALIANT Centre for Computer Studies, University of Leeds, Leeds, United Kingdom

More information