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

Similar documents
ECS 120 Lesson 16 Turing Machines, Pt. 2

Theory of Languages and Automata

CS21 Decidability and Tractability

Enumerations and Turing Machines

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

Outline. Language Hierarchy

Turing Machine Languages

Variants of Turing Machines

Theory of Computation, Homework 3 Sample Solution

(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

The Big Picture. Chapter 3

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

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

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

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

Introduction to Computers & Programming

CISC 4090 Theory of Computation

Actually talking about Turing machines this time

Theory of Computations Spring 2016 Practice Final Exam Solutions

Computer Sciences Department

Computability and Complexity

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.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

14.1 Encoding for different models of computation

Equivalence of NTMs and TMs

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

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

Theory of Programming Languages COMP360

CSE 105 THEORY OF COMPUTATION

A Characterization of the Chomsky Hierarchy by String Turing Machines

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

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

Reflection in the Chomsky Hierarchy

CT32 COMPUTER NETWORKS DEC 2015

1. [5 points each] True or False. If the question is currently open, write O or Open.

CSE 105 THEORY OF COMPUTATION

CpSc 421 Final Solutions

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

Formal languages and computation models

Material from Recitation 1

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Recursively Enumerable Languages, Turing Machines, and Decidability

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

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

CSE 105 THEORY OF COMPUTATION

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

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

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

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

COMP 382: Reasoning about algorithms

CS402 - Theory of Automata Glossary By

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

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

CS 44 Exam #2 February 14, 2001

Limited Automata and Unary Languages

SECTION A (40 marks)

Turing Machines, continued

Lecture T4: Computability

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

Multiple Choice Questions

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

UNIT I PART A PART B

Lecture 18: Turing Machines

CS525 Winter 2012 \ Class Assignment #2 Preparation

Chapter 14: Pushdown Automata

Structure of a Compiler: Scanner reads a source, character by character, extracting lexemes that are then represented by tokens.

pp Variants of Turing Machines (Sec. 3.2)

CS 531: Notes II. January 31, 2014

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

A Note on the Succinctness of Descriptions of Deterministic Languages

THEORY OF COMPUTATION

Theory of Computations Spring 2016 Practice Final

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

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

Theory of Computation

(a) Give inductive definitions of the relations M N and M N of single-step and many-step β-reduction between λ-terms M and N. (You may assume the

2.8 Universal Turing Machines and the Halting Problem

Final Course Review. Reading: Chapters 1-9

Slides for Faculty Oxford University Press All rights reserved.

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

Theory of Computation Prof. Raghunath Tewari Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Recursive and Recursively Enumerable Languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

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

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS


Decision Properties for Context-free Languages

Computability Summary

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

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Problems, Languages, Machines, Computability, Complexity

Turing Machines Part Two

6. Advanced Topics in Computability

CSC-461 Exam #2 April 16, 2014

Lecture 5: The Halting Problem. Michael Beeson

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

Theory Bridge Exam Example Questions Version of June 6, 2008

Verification in Loosely Synchronous Queue-Connected Discrete Timed Automata

Context Free Languages and Pushdown Automata

Elementary Recursive Function Theory

Transcription:

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 Church s Hypothesis 5.5 Recursively Enumerable Language 5.6 Recursive Languages 5.7 Halting Problem 5.8 Introduction to Undecidability 5.9 Post's Correspondence Problem (PCP) 5.10 Chomsky Hierarchy 5.11 Introduction to recursive function theory

TAFL 2 (ECS-403) 5.1 Turing Machine: The basic model of a Turing machine has a finite control, an input tape that is divided into cells, and a tape head that scans one cell of the tape at a time. The tape has a leftmost cell but is infinite to the right. Each cell of the tape may hold exactly one of a finite number of tape symbols. Initially, the n leftmost cells, for some finite n >= 0, hold the input, which is a string of symbols chosen from a subset of the tape symbols called the input symbols. The remaining infinity of cells each hold the blank, which is a special symbol that is not an input symbol. A Turing machine can be formally defined as M = (Q,Σ,Γ,,q0,B,F):, where Q, a finite set of states Γ, is the finite set of allowable tape symbols B, a symbol of Γ, is the blank Σ, a subset of Γ not including B, is the set of input symbols : Q x Γ Q x Γ x {L, R} ( may, however, be undefined for some arguments) q0 in Q is the initial state F Q is the set of final states

TAFL 3 (ECS-403)

TAFL 4 (ECS-403)

TAFL 5 (ECS-403)

TAFL 6 (ECS-403) 5.2 TM as computer of Integer Function: The Turing Machine has a computation capability. Many problems can be solved using Turing Machines. Hence TM is more often compared with computers. There are two claims that are made in regards to TM and computers 5.2.1 Simulating Turing Machine by Computer: i. Simulation means to mimic the behavior. Using computer the behavior of turing machine can be represented. The model of TM consists of two main things - finite control and input tape. ii. For a Turing Machine M, a computer program can be written which acts as a finite control. There are finite number of states and finite number of transition rules. Hence the computer program can encode states as character strings. The transition table can be built for mapping the transition rules. Our computer program performs lookup to this table to determine next move. iii. iv. To simulate input tape of TM M, storage devices such as hard disks, magnetic tapes can be used. But the question arises. How can we simulate an infinite tape with fixed amount of memory? Then the simple answer is that we may require large number of disk and contents need to be swapped wherever required. The simulation of TM by computer can be shown in following figure: For storing the data in cells of input tape we use multiple hard disks that are arranged in stack. The data in the cells that are left to tape head is stored in left stack. The data in the cells to tape head is stored in the right stack of hard disks.

TAFL 7 (ECS-403) v. When the tape head moves to the left cell then corresponding content in the left stack of disk will be swapped to right stack of hard disks. It prints the message swap right. Similarly when the tape head is moved to the right the message swap left will be printed. When there no input data on the tape i.e. when the tape contains all the blank characters then both the stack are empty. 5.2.2 Simulating Computer by Turing Machine: i. There will be multiple TM used to store the contents and addresses. The first tape represents the memory and on this tape represents the memory and on this tape contents along with their addresses will be stored. The addresses can be represented by binary numbers and contents can be denoted in words. Some Special symbols such as * and # can be used as end markers for separating addresses and contents. The end character $ is placed at the beginning to indicate beginning of sequences. ii. The second tape represents instruction counter. This is a binary value which represents some integer. This value represents the memory location of the next instruction to be executed. iii. The third tape represents memory address. Generally this address is of the contents that are stored in tape 1. These contents may be involved in some computations.

TAFL 8 (ECS-403) 5.3 Universal Turing Machine: The universal language L u is a set of binary strings which can be modeled by a turing machine. The universal language can be represented by a pair (M, w) where M is a TM that accepts this language and w is a binary string in (o+1)* such that w belongs to L(M). Thus we can say that any binary string belongs to a universal language. From this the concept of universal turing machine came up. The universal language can be represented by L u = L (U) where U is a universal turing machine. In fact U is a binary string which represents various codes of many turing machines. The TM U is a multitape turing machine which can be shown below: i. The Universal Turing Machine U accepts the TM M. ii. The transitions of M are stored initially on the first tape along with the string w. iii. On the second tape the simulated tape of M is placed. Here the tape symbol X i of M will be represented by 0 i and tape symbols represented by single 1 s. iv. On the third tape various states of machine M are stored. The state q i is represented by i 0 s. Operations on Turing Machine: 1) The first tape is observed carefully to check whether the code for M is valid or not. If the code is not valid then U halts without accepting. As invalid codes are assumed to represent the TM with no moves, such TM accepts no inputs and halts. 2) Initialize the second tape for placing the tape values of M in encoded form that means for each 0 of the input w place 10 on the second tape and for each 1 place 100 there. The blank letters of tape of machine M are represented by 1000. But actually blank appears at the end of input w for the machine U.

TAFL 9 (ECS-403) 3) As the third tape stores states of Machine M, place 0 there as the start state of machine M. The head of third tape will now position at start state and head for tape 2 will position at the first simulated cell of second tape. 4) Now the move of M can be simulated. As on the first tape transitions are stored U first searches the tape 1 to know the transitions which are always given in the form 0 i 10 j 10 k 10 l 10 m, as we have already seen that such a turing machine code consist of 0 i means current state. 0 j means input tape symbol 0 k means changed state 0 l means changed input tape symbol 0 m means direction in which the head is to be moved. Now to simulate the move of M change the content of tape 3 to 0 k that is, Simulate the state change of M. Then replace 0 i on tape2 by 0 l, that is simulate the change in input. Then move the tape head moves to left or right depending upon the value of m. that means if m=1 then move left and if m=2 move right. Thus U simulate the move of M to left or to the right. 5) If M has no transition then no transition is performed. Therefore M halts in the simulated configuration and hence U halts. 6) If M enters in accept state, then U accepts. Thus the Turing Machine M on binary input string w where a pair (M, w) is also coded in binary form. 5.4 Church s Hypothesis: Hypotheis means proposing certain facts. The church s hypothesis or church s turing thesis can be stated as, The assumption that the intuitive notion of computable functions can be identified with partial recursive function. However, this hypothesis cannot be proved. The computability of recursive functions is based on the following assunptions: i. Each elementary function is computable. ii. Let f be the computable function and g be the another function which can be obtained by applying an elementary operation to f, then g becomes a computable function. iii. Any function becomes computable if it is obtained by rule i and ii.

TAFL 10 (ECS-403) 5.5 Recursively Enumerable Language : ( or TM-recognizable langauge or semi-decidable language) Simply speaking, a language L is recursively enumerable if some Turing Machine accepts it. Formally, the class of r.e. languages is defined as { L and TM M such that L = L(M) } So, on input string, M enters an accepting ID and halts. But, on input strings, M either halts entering a bloueing ID (i.e. without entering an accepting ID), or it never halts (i.e. it loops for ever). 5.6 Recursive (or Decidable) Languages A language L is recursive if there is some TM M that halts on every input and L = L(M). Formally, the class of recursive language is defined as { L and TM M such that M halts and L = L(M) } So, on any input strings w L, M enters an accepting ID and halts and On an input string w L, M halts entering in a blocking ID (or entering in a reject state). 5.7 Halting Problem: To state halting problem we will consider the given configuration of a turing machine. The output of TM can be i. Halt: The machine starting at this configuration will halt after a finite number of states. ii. No Halt: The machine starting at this configuration never reaches a half state, no matter how long it runs.

TAFL 11 (ECS-403) Example: function K() { if (H()=="loop"){ return; } else { while(true); //loop forever } } 5.8 Introduction to Undecidability: 5.8.1 Decidability: i. A language L is decidable if there is a Turing machine M such that L(M) = L and M halts on every input. ii. If L is decidable then L is recursively enumerable. 5.8.2 Undecidability: i. A language L is undecidable if L is not decidable. Thus, there is no Turing machine M that halts on every input and L(M) = L. ii. This means that either L is not recursively enumerable. That is there is no turing machine M such that L(M) = L. iii. L is recursively enumerable but not decidable. That is, anyturing machine M such that L(M) = L, M does not halt on some inputs. Some Proof: (for solution see lecture slide of Prof. Agha-Viswanathan ) i. L d is not recursively enumerable. ii. A tm is r.e. but not decidable.

TAFL 12 (ECS-403) 5.9 Post's Correspondence Problem (PCP): A post correspondence system consists of a finite set of ordered pairs where for some alphabet. Any sequence of numbers is called a solution to a Post Correspondence System. The Post's Correspondence Problem is the problem of determining whether a Post Correspondence system has a solution.

TAFL 13 (ECS-403) 5.10 Chomsky Hierarchy Let G = ( N,, P, S ) be a grammar then G is called a Type-0 or unrestricted, or semi-there or phrase-structure grammar if all productions are of the form, where and G is a Type-1 or context-sensitive grammar if each production in P satisfies such that and. Type-1 grammar, by special dispensation, is allowed to have the production, provided S does not appear on the right-hand side of any production. G is a Type-2 or context-free grammar if each production in P satisfies i.e. is a single nonterminal. G is a Type-3 or right-linear or regular grammar if each production has one of the following three forms:, A b, A where A, C N ( with A = C allowed ) and. The language generated by a Type-i grammar is called a Type-i language, i = 0,1,2,3. A Type-i language is also called a context-sensitive language (CSL). We have already observed that a Type-2 language is also called a Context-Free Language (CFL) and a Type-3 language is also called a regular language. Each class of language in the Chomsky hierarchy is characterized as the language generated by a type of automata. These relationships have been summarised in the folowing table for convenience.

TAFL 14 (ECS-403) Grammars Languages Automata Type-0, phrase-struct, semitrue, Recursively enumerable Turing Machine language unrestricted grammars Type-0, phrase-struct, semitrue, Context-sensitive Linear-bounded automata language unrestricted grammars Type-2, context-free grammars Context-free language Pushdown Automata Type-3, regular, right-linear, Regular Language left-linear grammar Finite Automata 5.11 Introduction to recursive function theory: