0% found this document useful (0 votes)
6 views

Recursive and Recursively Enumerable Languages

Toc

Uploaded by

kavinjothi18
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Recursive and Recursively Enumerable Languages

Toc

Uploaded by

kavinjothi18
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Recursive and Recursively

Enumerable Languages
Halt State
• The Turing machine's computation ends when it enters its
halt state. It is possible that a computation might never end
because the machine never enters the halt state. This is
analogous to an infinite loop in a computer program.
Recursive language
• A language ‘L’ is said to be recursive if there exists a Turing
Machine which will accept all the strings in ‘L’ and reject all the
strings not in ‘L’.
• The turing machine will halt every time and give an answer
(accepted or rejected) for each and every input.
Recursively Enumerable Language
• A language ‘L’ is said to be recursively enumerable language if
there exists a Turing Machine which will accept for all the input
strings which are in ‘L’.
• But may or may not halt for all input strings which are not in ‘L’
causing it to enter in loop.
Decidable Language
A language ‘L’ is decidable if it is a recursive language. All
decidable languages are recursive languages and vice-versa.

Partially Decidable Language


A language ‘L’ is partially decidable if ‘L’ is a recursively
enumerable language.
Undecidable language
• A language is undecidable if it is not decidable.
• An undecidable language may sometimes be partially decidable
but not decidable.
• If a language is not even partially decidable, then there exists no
Turing machine for that language.
Decidable Vs undecidable languages
Recursive language
Recursively Enumerable (RE) language
Representation
Note
Decidable Problem
• For a decidable language, for each input string, the TM halts
either at the accept or the reject state.
Example 1
• Find out whether the following problem is decidable or not −
• Is a number ‘m’ prime?

Solution
• Prime numbers = {2, 3, 5, 7, 11, 13, …………..}
• Divide the number ‘m’ by all the numbers between ‘2’ and ‘√m’
starting from ‘2’.
• If any of these numbers produce a remainder zero, then it goes
to the “Rejected state”, otherwise it goes to the “Accepted state”.
So, here the answer could be made by ‘Yes’ or ‘No’.
• Hence, it is a decidable problem.
Example 2
• Given a regular language L and string w, how can we check if w
∈ L?
Solution
• Take the DFA that accepts L and check if w is accepted
Language
• If a language L is decidable, then its complement L' is
also decidable.

• If a language is decidable, then there is an enumerator


for it.
Undecidable Languages
• For an undecidable language, there is no Turing Machine which
accepts the language and makes a decision for every input
string w (TM can make decision for some input string though).

• A decision problem P is called “undecidable” if the language L


of all yes instances to P is not decidable.

• Undecidable languages are not recursive languages, but


sometimes, they may be recursively enumerable languages.
Example
1. The halting problem of Turing machine

2. The Post correspondence problem


• The undecidability of the string is determined with the help of Post
Correspondence Problem (PCP)
Halting Problem

• Deals with two decision problems:


1. Accepts: Given a TM, T and a string w, is w ϵ L(T).

2. Halts: Given a TM, T and a string w, does T halt on input, w.

• Can be stated in two ways, for a given TM and string w


1. Does the TM accepts the string, w?

2. Whether TM halts by accepting / rejecting the string, w?


Halting Problem
• Given an arbitrary TM and arbitrary input for the machine, then
is it possible to determine whether the machine will ever halt on
given input? This is called halting problem.

• That means we are asking for a procedure which enable us to


solve the halting problem for every pair (machine & input). The
answer is “no”. That is halting problem is unsolvable.
Halting Problem is undecidable
• Input − A Turing machine and an input string w.
• Problem − Does the Turing machine finish computing of the
string w in a finite number of steps? The answer must be either yes
or no.
• Proof − At first, we will assume that such a Turing machine
exists to solve this problem and then we will show it is
contradicting itself. We will call this Turing machine as a
Halting machine that produces a ‘yes’ or ‘no’. If the halting
machine finishes in a finite amount of time, the output comes as
‘yes’, otherwise as ‘no’.
Cont..,
• The block diagram of a Halting machine −
Cont..,
• Now we will design an inverted halting machine (HM)’ as −
• If H returns YES, then loop forever.
• If H returns NO, then halt.
• The block diagram of an ‘Inverted halting machine’ −
Cont..,
• Further, a machine (HM)2 in which input itself is constructed as
follows −
• If (HM)2 halts on input, loop forever.
• Else, halt.
• Here, we have got a contradiction. Hence, the halting problem is
undecidable.
Post Correspondence Problem (PCP)
• Devised by Emli Post
• An abstract problem which involves string rather than TMs.
• Tool for proving problems in logic or in formal language theory
to be undecidable.
Post correspondence problem
➢ It was introduced by Emil Leon post in 1946.
➢ It is undecidable.
➢ It is simpler than Halting problem.
➢ The aim is to arrange tiles in such order that string made by
numerators is same as string made by denominators.
➢ Post correspondence problem can be represented in two ways
1.Domino’s form
2.Table form
1.DOMINO’S FORM

2.TABLE FORM
Let us consider the following example:

• Step-1: We will start with tile in which numerator


and denominator are starting with same number,
so we can start with either 1 or 2. Lets go
with second tile, string made by numerator-
10111, string made by denominator is 10.
• Step-2: We need 1s in denominator to match 1s in
numerator so we will go with first tile, string made
by numerator is 10111 1, string made by
denominator is 10 111.
• Step-3: There is extra 1 in numerator to match this
1 we will add first tile in sequence, string made by
numerator is now 10111 1 1, string made by
denominator is 10 111 111.
• Step-4: Now there is extra 1 in denominator to
match it we will add third tile, string made by
numerator is 10111 1 1 10, string made by
denominator is 10 111 111 0

Final Solution - 2 1 1 3 String made by numerators: 101111110 String made by denominators: 101111110
• Example-2:
• Step-1: We will start from tile 1 as it is our only option, string made by numerator
is 100, string made by denominator is 1.
• Step-2: We have extra 00 in numerator, to balance this only way is to add tile 3 to
sequence, string made by numerator is 100 1, string made by denominator is 1
00.
• Step-3: There is extra 1 in numerator to balance we can either add tile 1 or tile 2.
Lets try adding tile 1 first, string made by numerator is 100 1 100, string made by
denominator is 1 00 1.
• Step-4: There is extra 100 in numerator, to balance this we can add 1st tile again,
string made by numerator is 100 1 100 100, string made by denominator is 1 00 1
1 1. The 6th digit in numerator string is 0 which is different from 6th digit in string
made by denominator which is 1.
• We can try unlimited combinations like one above but none of combination will
lead us to solution, thus this problem does not have solution.
Undecidability of Post Correspondence Problem : As theorem says
that PCP is undecidable. That is, there is no particular algorithm
that determines whether any Post Correspondence System has
solution or not

You might also like