Recursive and Recursively Enumerable Languages

Similar documents
Outline. Language Hierarchy

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

Computability Summary

Theory of Computation, Homework 3 Sample Solution

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

Computer Sciences Department

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

CSC-461 Exam #2 April 16, 2014

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

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

Turing Machine Languages

CSE 105 THEORY OF COMPUTATION

Recursively Enumerable Languages, Turing Machines, and Decidability

Formal languages and computation models

Variants of Turing Machines

ECS 120 Lesson 16 Turing Machines, Pt. 2

Enumerations and Turing Machines

Multiple Choice Questions

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

CS21 Decidability and Tractability

pp Variants of Turing Machines (Sec. 3.2)

5.2: Closure Properties of Recursive and Recursively Enumerable Languages

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Elementary Recursive Function Theory

CS 531: Notes II. January 31, 2014

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

UNIT I PART A PART B

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final

Theory Bridge Exam Example Questions Version of June 6, 2008

Slides for Faculty Oxford University Press All rights reserved.

Final Course Review. Reading: Chapters 1-9

Turing Machines, continued

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

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

Theory of Languages and Automata

Lecture 18: Turing Machines

Computable Sets. KR Chowdhary Professor & Head.

Tutorial: Computable Model Theory and Differential Algebra

CS402 - Theory of Automata Glossary By

CpSc 421 Final Solutions

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


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

Material from Recitation 1

SECTION A (40 marks)

Regular Expressions & 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.

Automata Theory CS S-FR Final Review

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

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

(Refer Slide Time: 0:19)

THEORY OF COMPUTATION

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

(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

CSE 20 DISCRETE MATH. Fall

Equivalence of NTMs and TMs

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

1 Finite Representations of Languages

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

AUTOMATA THEORY AND COMPUTABILITY

Languages and Strings. Chapter 2

The Big Picture. Chapter 3

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

Theory of Programming Languages COMP360

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

Ambiguous Grammars and Compactification

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

Context-Free Languages and Parse Trees

CSE 105 THEORY OF COMPUTATION

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

2. Lexical Analysis! Prof. O. Nierstrasz!

(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

CMSC 132: Object-Oriented Programming II

CISC 4090 Theory of Computation

Computability and Complexity

2.8. Connectedness A topological space X is said to be disconnected if X is the disjoint union of two non-empty open subsets. The space X is said to

CS402 - Theory of Automata FAQs By

Homework Set #2 Math 440 Topology Topology by J. Munkres

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

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

English for Computer Science

Introduction to Sets and Logic (MATH 1190)

ECS 120 Lesson 7 Regular Expressions, Pt. 1

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

Actually talking about Turing machines this time

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

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

Learn Smart and Grow with world

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

The Generalized Star-Height Problem

COMP Logic for Computer Scientists. Lecture 25

CSE 20 DISCRETE MATH. Winter

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016

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

The Front End. The purpose of the front end is to deal with the input language. Perform a membership test: code source language?

Rice s Theorem and Enumeration

CS 44 Exam #2 February 14, 2001

Transcription:

Recursive and Recursively Enumerable Languages Prof. (Dr.) K.R. Chowdhary Email: kr.chowdhary@iitj.ac.in Formerly at department of Computer Science and Engineering MBM Engineering College, Jodhpur Monday 10 th April, 2017 kr chowdhary TOC 1/ 11

Defining R and RE languages Recursive: They allow a function to call itself. Or, a recursive language is a recursive subset in the set of all possible words over alphabet Σ of that language. Non-recursive should not be taken as simpler version of computation, i.e., e.g., obtaining factorial value without recursion method. Regular languages context free languages context sensitive languages recursive languages recursive enumerable languages. A language is Recursively Enumerable (RE) if some Turing machine accepts it. - A TM M with alphabet Σ accepts L if L={w Σ M halts with input w } - Let L be a RE language and M the Turing Machine that accepts it., for w L, M halts in final state. For w / L, M halts in non-final state or loops for ever. A language is Recursive (R) if some Turing machine M recognizes it and halts on every input string, w Σ. Recognizable = Decidable. Or A language is recursive if there is a membership algorithm for it. Let L be a recursive language and M the Turing Machine that accepts (i.e. recognizes) it. For string w, if w L, then M halts in final state. If w / L, then M halts in non-final state. (halts always!). kr chowdhary TOC 2/ 11

Relation between Recursive and RE languages. diagonal languages Recursive languages. Non-RE RE but not Recursive Every Recursive language is RE., if M is TM recognizing L, the M can be easily modified so its accepts L. The languages which are non-re cannot be recognized by TM. These are diagonal (L d ) languages of the diagonal of x y, where x i is language string w i, and y i is TM M i. Language <M,w >, where M is TM and w is string, is not RE language, since its generalized form is not Turing decidable (undecidability proof),, it is non-re language. kr chowdhary TOC 3/ 11

Every is recursive language can be enumerated If a language L is recursive then there exists an enumeration procedure for it. If Σ={a,b}, then Mðcan enumerate strings: a,b,aa,ab,ba,bb,aaa,... ----------------- Enumerating machine -------------------- RM TMM A Enumerates all the strings of i/p alphabets accepts L Enumeration procedure: Mðgenerates string w. M checks, if w L; if, output w else ignore w. Let L={a,ab,bb,aaa,...}. Mðoutput = {a,b,aa,ab,ba,bb,aaa,}; L(M)={a,ab,bb,aaa,...}; enumerated output =a,ab,bb,aaa,... kr chowdhary TOC 4/ 11

Class of Languages recursive = decidable, their TM always halts recursive enumerable (semi-decidable) but not recursive = their TM always halt if they accept, otherwise halts in non-final state or loops. non-recursively enumerable (non-re) = there are no TMs for them. Recursive languages are closed under complementation. If L is recursive then L is also recursive. The accepting states of M are made non-accepting states of M with no transitions, i.e., here M will halt without accepting. If s is new accepting state in M, then there is no transition from this state. If L is recursive, then L = L(M) for some TM M, that always halts. Transform M into Mð so that Mð accept when M does not and vice-versa. So Mð always halts and accepts L. Hence L is recursive. kr chowdhary TOC 5/ 11

Proof If L and L are RE, then L is recursive. Let L=L(M 1 ) and L=L(M 2 ). Construct a TM M that simulates M 1 and M 2 in parallel, using two tapes and two heads. If i/p to M is in L, then M 1 accepts it and halts, hence M accepts it and halts. If input to M is not in L, hence it is in L,, M 2 accepts and halts, hence M halts without accepting. Hence M halts on every i/p and L(M) = L. So L is recursive. x M1 M2 Accept Accept Accept Reject TM M Closure Properties: Recursive languages are closed under union, concatenation, intersection and Kleene star, complement, set difference (L 1 L 2 ) kr chowdhary TOC 6/ 11

RE Language A language L is recursive enumerable iff there exists an enumeration procedure for it. If there is an enumeration procedure, then we can enumerate all the strings, and compare each with w each time till it is found. If the language is RE, then we can follow an enumerature procedure to systematically generate all the strings. kr chowdhary TOC 7/ 11

Intersection of RE and R languages Given a Recursive and a RE languages: Their Union is RE, Intersection is RE, Concatenation is RE, and Kleene s closure is RE. if L 1 is Recursive and L 2 is RE, then L 2 L 1 is RE and L 1 L 2 is not RE. The intersection R and RE languages is RE. Let L 1 and L 2 be languages recognized by Turing machines M 1 and M 2, respectively. Let a new TM M is for the intersection L 1 L 2. M simply executes M 1 and M 2 one after the other on the same input w: It first simulates M 1 on w. If M 1 halts by accepting it, M clears the tape, copies the input word w on the tape and starts simulating M 2. If M 2 also accepts w then M accepts. Clearly, M recognizes L 1 L 2, and if M 1 and M 2 halt on all inputs then also M halts on all inputs. kr chowdhary TOC 8/ 11

closure properties... The union of two Recursive languages is recursive. The TM corresponding to this must halt always. Let L 1 and L 2 be sets accepted by M 1 and M 2, respectively. Then L 1 L 2 is accepted by TM M, where x =w 1 w 2, for w 1 L 1 and w 2 L 2. x M1 no M2 no no kr chowdhary TOC 9/ 11

Closure properties... The union of two RE languages is RE. Let L 1 and L 2 be sets accepted by M 1 and M 2, respectively. Then L 1 L 2 is accepted by TM M, where x =w 1 w 2, for w 1 L 1 and w 2 L 2. To determine if M 1 or M 2 accepts x we run both M 1 and M 2 simultaneously, using a two-tape TM M. M simulates M 1 on the first tape and M 2 on the second tape. If either one enters the final state, the input is accepted. x M1 M2 TM M kr chowdhary TOC 10/ 11

Summary of R and RE Both L and L are recursive, then both are in the inner circle. Palindrome and CFG are recursive. Neither L or L are RE, the both are outside the outer ring. L is RE but not recursive, and L is non-re; then first is in outer circle, and second is in outer most space. There are languages which are neither recursive nor RE (Ref: Countable algorithms(tm) but uncountable languages) Closure of recursive language in L 1 L 2 follows from the fact that these set difference can be expressed in terms of intersection and complement. Weak Result: If a language is recursive then there is an enumeration procedure. Strong Result: A language is RE iff there is an Enumeration kr chowdhary TOC 11/ 11. diagonal languages Recursive languages. Non-RE RE but not Recursive