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

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

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

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

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

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

Theory of Computation, Homework 3 Sample Solution

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

Turing Machine Languages

Theory of Programming Languages COMP360

Computer Sciences Department

Rice s Theorem and Enumeration

Outline. Language Hierarchy

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

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

Decision Properties for Context-free Languages

(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

Actually talking about Turing machines this time

CS21 Decidability and Tractability

where is the transition function, Pushdown Automata is the set of accept states. is the start state, and is the set of states, is the input alphabet,

JNTUWORLD. Code No: R

Material from Recitation 1

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

Theory of Languages and Automata

Theory Bridge Exam Example Questions Version of June 6, 2008

Lec-5-HW-1, TM basics

Recursively Enumerable Languages, Turing Machines, and Decidability

CT32 COMPUTER NETWORKS DEC 2015

Theory of Computations Spring 2016 Practice Final Exam Solutions

QUESTION BANK. Unit 1. Introduction to Finite Automata

Enumerations and Turing Machines

The Big Picture. Chapter 3

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

A Characterization of the Chomsky Hierarchy by String Turing Machines

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Variants of Turing Machines


Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

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.

CpSc 421 Final Solutions

ECS 120 Lesson 16 Turing Machines, Pt. 2

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

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

Formal Grammars and Abstract Machines. Sahar Al Seesi

Languages and Automata

Problems, Languages, Machines, Computability, Complexity

t!1; R 0! 1; R q HALT

Formal Languages and Automata

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

Equivalence of NTMs and TMs

UNIT I PART A PART B

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

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

Theory of Computation

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

KEY. A 1. The action of a grammar when a derivation can be found for a sentence. Y 2. program written in a High Level Language

Computability Summary

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

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

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

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

Theory of Computations Spring 2016 Practice Final

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

Multiple Choice Questions

Automata Theory CS S-FR Final Review

CSE 120. Computer Science Principles

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

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

Final Course Review. Reading: Chapters 1-9

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

CS 441G Fall 2018 Exam 1 Matching: LETTER

Context Free Languages and Pushdown Automata

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

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

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

14.1 Encoding for different models of computation

Languages and Compilers

AUTOMATA THEORY AND COMPUTABILITY

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions

Regular Expressions & Automata

Turing Machines, continued

CSE 105 THEORY OF COMPUTATION

AUBER (Models of Computation, Languages and Automata) EXERCISES

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

A Note on the Succinctness of Descriptions of Deterministic Languages

CISC 4090 Theory of Computation

Ambiguous Grammars and Compactification

Today, we will dispel the notion that Java is a magical language that allows us to solve any problem we want if we re smart enough.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

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

Reflection in the Chomsky Hierarchy

Power Set of a set and Relations

Models of Computation II: Grammars and Pushdown Automata

Lambda Calculus and Computation

Introduction to Computers & Programming

Practice: Large Systems Part 2, Chapter 2

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

Chapter 14: Pushdown Automata

Automata & languages. A primer on the Theory of Computation. The imitation game (2014) Benedict Cumberbatch Alan Turing ( ) Laurent Vanbever

Limited Automata and Unary Languages

CSE 105 THEORY OF COMPUTATION

Transcription:

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 Continued Universal Turing achine 2002 1 2 3 A limitation of Turing achines: Turing achines are hardired they execute only one program Real Computers are re-programmable Solution: Universal Turing achine Characteristics: Reprogrammable machine Simulates any other Turing achine Universal Turing achine simulates any other Turing achine Input of Universal Turing achine Description of transitions of Initial tape contents of 4 5 6 Tape 1 Three tapes Universal Turing achine Description of Tape 2 Tape Contents of Tape 1 Description of We describe Turing machine as a string of symbols: Alphabet Encoding Symbols: a b c d l Tape 3 State of We encode as a string of symbols Encoding: 1 11 111 1111 7 8 9

State Encoding States: 1 2 3 4 l Transition Encoding achine Encoding Encoding: 1 11 111 1111 ove: Head ove Encoding R Transition: δ ( 1, a) = ( 2, b, ) Encoding: 1 01 011 011 01 separator Transitions: δ ( 1, a) = ( 2, b, Encoding: 1 01 011 011 01 00 ) δ ( 2, b) = ( 3, c, R) 11 0110111 0111 011 Encoding: 1 11 10 11 separator 12 Tape 1 contents of Universal Turing achine: encoding of the simulated machine as a binary string of 0 s and 1 s 13 A Turing achine is described ith a binary string of 0 s and 1 s. Therefore: The set of Turing machines forms a language: Each string of the language is the binary encoding of a Turing achine. 14 anguage of Turing achines = { 010100101, (Turing achine 1) 00100100101111, (Turing achine 2) 111010011110010101, } 15 The Chomsky Hierarchy Unrestricted Grammars String of variables and terminals Productions u v String of variables and terminals Example of unrestricted grammar S abc ab ca Ac d 16 17 18

Context-Sensitive Grammars The language n n n { a b c } A language is recursively enumerable if and only if it is generated by an unrestricted grammar. String of variables and terminals Productions u v and u v String of variables and terminals is context-sensitive: S abc aabc Ab ba Ac Bbcc bb Bb ab aa aaa 19 20 21 inear Bounded Automaton (BA) A language is context sensitive if and only if it is accepted by a inear-bounded automaton. inear Bounded Automata (BAs) are the same as Turing achines ith one difference: The input string tape space is the only tape space alloed to use. eft-end marker Input string [ a b c d e ] Working space in tape Right-end marker 22 23 All computation is done beteen end markers. 24 Observation There is a language hich is context-sensitive but not recursive. Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free Regular Decidability 25 The Chomsky anguage Hierarchy 26 27

Consider problems ith anser or. Examples Does achine have three states? Is string a binary number? Does DFA accept any input? A problem is decidable if some Turing machine solves (decides) the problem. Decidable problems: Does achine have three states? Is string a binary number? Does DFA accept any input? The Turing machine that solves a problem ansers or for each instance. Input problem instance Turing achine 28 29 30 The machine that decides a problem: If the anser is then halts in a yes state If the anser is then halts in a no state These states may not be final states. Turing achine that decides a problem Difference beteen Recursive anguages and Decidable problems For decidable problems: The states may not be final states. 31 and states are halting states 32 33 Some problems are undecidable: There is no Turing achine that solves all instances of the problem. A simple undecidable problem: The membership problem The embership Problem Input: Turing achine String Question: Does accept? 34 35 36

The membership problem is undecidable. Assume for contradiction that the membership problem is decidable. There exists a Turing achine H that solves the membership problem H accepts rejects et be a recursively enumerable language. et be the Turing achine that accepts. We ill prove that is also recursive: We ill describe a Turing machine that accepts and halts on any input. 37 38 39 Turing achine that accepts and halts on any input H accepts? accept reject Therefore, is recursive. Since is chosen arbitrarily, e have proven that every recursively enumerable language is also recursive. But there are recursively enumerable languages hich are not recursive. Therefore, the membership problem is undecidable. Contradiction! 40 41 42 A famous undecidable problem: The halting problem The Halting Problem Input: Turing achine String Question: Does halt on? The halting problem is undecidable. Assume for contradiction that the halting problem is decidable. 43 44 45

There exists Turing achine H that solves the halting problem Construction of H H halts on doesn t halt on Input: initial tape contents 0 Encoding String of H y n Construct machine H If H returns then loop forever. If H returns then halt. 46 47 48 0 H H y n oop forever a b Construct machine Input: Ĥ (machine ) If halts on input Then loop forever Else halt copy Ĥ H 49 50 51 Run machine Ĥ ith input itself Input: If Ĥ H ˆ (machine Ĥ ) halts on input Then loop forever Else halt H ˆ Ĥ on input Ĥ H ˆ If halts then loops forever. Ĥ : If doesn t halt then it halts. CONTRADICTION! This means that The halting problem is undecidable. 52 53 54

Another proof of the same theorem If the halting problem as decidable then every recursively enumerable language ould be recursive. The halting problem is undecidable. Assume for contradiction that the halting problem is decidable. There exists Turing achine H that solves the halting problem. H halts on doesn t halt on 55 56 57 et be a recursively enumerable language. et be the Turing achine that accepts. We ill prove that is also recursive: We ill describe a Turing machine that accepts and halts on any input. 58 Turing achine that accepts and halts on any input H halts on? Run ith input reject accept Halts on final state reject Halts on non-final Therefore is recursive. Since is chosen arbitrarily, e have proven that every recursively enumerable language is also recursive. But there are recursively enumerable languages hich are not recursive. Contradiction! 59 60 state Problem A is reduced to problem B Therefore, the halting problem is undecidable. Reducibility B If e can solve problem then e can solve problem A. B A 61 62 63

Problem A is reduced to problem If B is decidable then A is decidable. If A is undecidable then B is undecidable. B Example the halting problem reduced to the state-entry problem. The state-entry problem Inputs: Question: Turing achine State String Does enter state on input? 64 65 66 The state-entry problem is undecidable. Reduce the halting problem to the state-entry problem. Suppose e have an algorithm (Turing achine) that solves the state-entry problem. We ill construct an algorithm that solves the halting problem. Assume e have the state-entry algorithm: state-entry problem enters doesn t enter 67 68 69 We ant to design the halting algorithm: Halting problem halts on doesn t halt on odify input machine Add ne state From any halting state add transitions to halts if and only if halts on state halting states Single halt state 70 71 72

halting problem Inputs: machine and string Halting problem algorithm We reduced the halting problem to the state-entry problem. 1. Construct machine ith state 2. Run algorithm for state-entry problem ith inputs:,, Generate State-entry algorithm Since the halting problem is undecidable, it must be that the state-entry problem is also undecidable. 73 74 75 Another example The halting problem reduced to the blank-tape halting problem. The blank-tape halting problem Input: Turing achine Question: Does halt hen started ith a blank tape? The blank-tape halting problem is undecidable. Reduce the halting problem to the blank-tape halting problem. 76 77 78 Assume e have the blank-tape halting algorithm We ant to design the halting algorithm: Suppose e have an algorithm for the blank-tape halting problem. We ill construct an algorithm for the halting problem. blank-tape halting problem halts on blanks tape doesn t halt on blank tape halting problem halts on doesn t halt on 79 80 81

Construct a ne machine On blank tape rites Then continues execution like halts on input string halting problem Inputs: machine and string step 1 if blank tape then rite step2 execute ith input if and only if halts hen started ith blank tape. 1. Construct 2. Run algorithm for blank-tape halting problem ith input 82 83 84 Halting problem algorithm Summary of Undecidable Problems Generate Blank-tape halting algorithm We reduced the halting problem to the blank-tape halting problem. Since the halting problem is undecidable, the blank-tape halting problem is also undecidable. Halting Problem Does machine halt on input? embership problem Does machine accept string? (In other ords: Is a string member of a recursively enumerable language?) 85 86 87 Blank-tape halting problem Does machine halt hen starting on blank tape? State-entry Problem: Does machine enter state on input? Uncomputable Functions Uncomputable Functions Domain f Range A function is uncomputable if it cannot be computed for all of its domain. 88 89 90

f (n) = Example An uncomputable function: maximum number of moves until any Turing machine ith n states halts hen started ith the blank tape. 91 Function f (n) is uncomputable. Assume for contradiction that f (n) is computable. Then the blank-tape halting problem is decidable. 92 blank-tape halting problem Input: machine 1. Count states of : 2. Compute f (m) m f (m) 3. Simulate for steps starting ith empty tape If halts then return otherise return 93 Therefore, the blank-tape halting problem must be decidable. Hoever, e kno that the blank-tape halting problem is undecidable. Therefore, function f (n) is uncomputable. Rice s Contradiction! 94 95 96 Definition Non-trivial properties of recursively enumerable languages: any property possessed by some (not all) recursively enumerable languages. Some non-trivial properties of recursively enumerable languages is empty is finite contains to different strings of the same length Rice s Any non-trivial property of a recursively enumerable language is undecidable. 97 98 99

We ill prove some non-trivial properties ithout using Rice s theorem. For any recursively enumerable language it is undecidable hether it is empty. We ill reduce the membership problem to the problem of deciding hether is empty. embership problem: Does machine accept string? 100 101 102 Assume e have the empty language algorithm: et be the machine that accepts ( ) = empty language problem ( ) ( ) empty not empty We ill design the membership algorithm: membership problem accepts rejects First construct machine : When enters a final state, compare original input string ith. Accept if original input is the same as. 103 104 105 membership problem Inputs: machine and string embership algorithm ( ) if and only if is not empty ( ) = { } 1. Construct ( ) 2. Determine if is empty : then ( ) : then ( ) construct Check if ( ) is empty 106 107 108

We reduced the empty language problem to the membership problem. Since the membership problem is undecidable, the empty language problem is also undecidable. Decidability continued For a recursively enumerable language it is undecidable to determine hether is finite. We ill reduce the halting problem to the finite language problem. 109 110 111 Assume e have the finite language algorithm: et be the machine that accepts finite language problem ( ) = ( ) ( ) finite not finite We ill design the halting problem algorithm: Halting problem halts on doesn t halt on First construct machine. Initially, simulates on input. When enters a halt state, accept any input (infinite language). Otherise accept nothing (finite language). 112 113 114 halts on halting problem: Inputs: machine and string achine for halting problem ( ) if and only if is not finite. 1. Construct ( ) 2. Determine if is finite : : then doesn t halt on then halts on construct Check if ( ) is finite 115 116 117

We reduced the finite language problem to the halting problem. Since the halting problem is undecidable, the finite language problem is also undecidable. 118 For a recursively enumerable language it is undecidable hether contains to different strings of same length. We ill reduce the halting problem to the to strings of eual length- problem. 119 et be the machine that accepts ( ) = Assume e have the to-strings algorithm: to-strings problem ( ) contains doesn t ( ) contain to eual length strings 120 We ill design the halting problem algorithm: Halting problem halts on doesn t halt on First construct machine. Initially, simulates on input. When enters a halt state, accept symbols or. a b (to eual length strings) halts on if and only if accepts a and b (to eual length strings) 121 122 123 halting problem Inputs: machine and string 1. Construct 2. Determine if accepts to strings of eual length : : then halts on then doesn t halt on achine for halting problem construct Check if ( ) has to eual length strings We reduced the to strings of eual length - problem to the halting problem. Since the halting problem is undecidable, the to strings of eual length problem is also undecidable. 124 125 126