You are on page 1of 7

Recursive Language

A language L is recursive (decidable) if L is the set of strings accepted by some


Turing Machine (TM) that halts on every input.
Example
When a Turing machine reaches a final state, it halts. We can also say that a
Turing machine M halts when M reaches a state q and a current symbol ‘a’ to
be scanned so that δ(q, a) is undefined.
There are TMs that never halt on some inputs in any one of these ways, So we
make a distinction between the languages accepted by a TM that halts on all
input strings and a TM that never halts on some input strings.

Recursive Enumerable Language


A language L is recursively enumerable if L is the set of strings accepted by
some TM.
If L is a recursive enumerable language then −
If w ∈ L then a TM halts in a final state,
If w ∉ L then a TM halts in a non-final state or loops forever.
If L is a recursive language then −
If w ∈ L then a TM halts in a final state,
If w ∉ L then TM halts in a non-final state.

Recursive Languages are also recursive enumerable


Proof − If L is a recursive then there is TM which decides a member in
language then −
 M accepts x if x is in language L.
 M rejects on x if x is not in language L.
Computable Problems – You are familiar with many problems (or
functions) that are computable (or decidable), meaning there exists some
algorithm that computes an answer (or output) to any instance of the problem
(or for any input to the function) in a finite number of simple steps. A simple
example is the integer increment operation:
f(x) = x + 1
It should be intuitive that given any integer x, we can compute x + 1 in a finite
number of steps. Since x is finite, it may be represented by a finite string of
digits. Using the addition method (or algorithm) we all learned in school, we
can clearly compute another string of digits representing the integer equivalent
to x + 1. Yet there are also problems and functions that are non-computable (or
undecidable or uncomputable), meaning that there exists no algorithm that can
compute an answer or output for all inputs in a finite number of simple steps.
(Undecidable simply means non-computable in the context of a decision
problem, whose answer (or output) is either “true” or “false”). 

Non-Computable Problems – A non-computable is a problem for which there


is no algorithm that can be used to solve it. The most famous example of a
non-computability (or undecidability) is the Halting Problem. Given a
description of a Turing machine and its initial input, determine whether the
program, when executed on this input, ever halts (completes). The alternative
is that it runs forever without halting. The halting problem is about seeing if a
machine will ever come to a halt when a certain input is given to it or if it will
finish running. This input itself can be something that keeps calling itself
forever, which means that it will cause the program to run forever. Another
example of an uncomputable problem is: determining whether a computer
program loops forever on some input. You can replace “computer program”
with “Turing machine or algorithm” if you know about the Turing machine. 
Chomsky Hierarchy in Theory of Computation

According to Chomsky hierarchy, grammar is divided into 4 types as follows: 


1. Type 0 is known as unrestricted grammar.
2. Type 1 is known as context-sensitive grammar.
3. Type 2 is known as a context-free grammar.
4. Type 3 Regular Grammar.

Type 0: Unrestricted Grammar: 


Type-0 grammars include all formal grammar. Type 0 grammar languages are
recognized by turing machine. These languages are also known as the
Recursively Enumerable languages. 

Grammar Production in the form of     where 


\alpha is ( V + T)* V ( V + T)* 
V : Variables 
T : Terminals. 

is ( V + T )*. 
In type 0 there must be at least one variable on the Left side of production. 
For example: 
Sab --> ba 
A --> S
Here, Variables are S, A, and Terminals a, b. 

Type 1: Context-Sensitive Grammar


Type-1 grammars generate context-sensitive languages. The language
generated by the grammar is recognized by the Linear Bound Automata  
In Type 1 
 First of all Type 1 grammar should be Type 0. 
 Grammar Production in the form of 

|\alpha |<=|\beta |

That is the count of symbol in  is less than or equal to 


Also β  ∈ (V + T)+

i.e. β can not be ε


  
For Example:
S --> AB
AB --> abc 
B --> b  
Type 2: Context-Free Grammar: Type-2 grammars generate context-free
languages. The language generated by the grammar is recognized by
a Pushdown automata.  In Type 2:
 First of all, it should be Type 1. 
 The left-hand side of production can have only one variable and there

is no restriction on 
|\alpha         | = 1.  
For example:
S --> AB 
A --> a 
B --> b 

Type 3: Regular Grammar: Type-3 grammars generate regular languages.


These languages are exactly all languages that can be accepted by a finite-state
automaton. Type 3 is the most restricted form of grammar. 
Type 3 should be in the given form only : 
V --> VT / T (left-regular grammar)
(or)
V --> TV /T (right-regular grammar)
For example:
S --> a
The above form is called strictly regular grammar.
There is another form of regular grammar called extended regular grammar. In
this form:
V --> VT* / T*.  (extended left-regular grammar)
(or) 
V --> T*V /T*  (extended right-regular grammar)
For example : 
S --> ab. 

Undecidable Problems
The problems for which we can’t construct an algorithm that can answer the
problem correctly in the infinite time are termed as Undecidable Problems in
the theory of computation (TOC).
A problem is undecidable if there is no Turing machine that will always halt an
infinite amount of time to answer as ‘yes’ or ‘no’.
Examples
The examples of undecidable problems are explained below. Here, CFG refers
to Context Free Grammar.
 Whether two CFG L and M equal − Since, we cannot determine all
the strings of any CFG, we can predict that two CFG are equal or
not.
 Given a context-free language, there is no Turing machine (TM)
that will always halt an infinite amount of time and give an answer
to whether language is ambiguous or not.
 Given two context-free languages, there is no Turing machine that
will always halt an infinite amount of time and give an answer
whether two context-free languages are equal or not.
 Whether CFG will generate all possible strings of the input
alphabet (∑*) is undecidable.

The Post Correspondence Problem (PCP)

The Post Correspondence Problem (PCP), introduced by Emil Post in 1946, is


an undecidable decision problem. The PCP problem over an alphabet ∑ is stated
as follows −
Given the following two lists, M and N of non-empty strings over ∑ −
M = (x1, x2, x3,………, xn)
N = (y1, y2, y3,………, yn)
We can say that there is a Post Correspondence Solution, if for some i 1,i2,
………… ik, where 1 ≤ ij ≤ n, the condition xi1 …….xik = yi1 …….yik satisfies.
Example 1
Find whether the lists
M = (abb, aa, aaa) and N = (bba, aaa, aa)
have a Post Correspondence Solution?
Solution
x1 x2 x3

M Abb aa aaa
N Bba aaa aa

Here,
x2x1x3 = ‘aaabbaaa’
and y2y1y3 = ‘aaabbaaa’
We can see that
x2x1x3 = y2y1y3
Hence, the solution is i = 2, j = 1, and k = 3.
Example 2
Find whether the lists M = (ab, bab, bbaaa) and N = (a, ba, bab) have a Post
Correspondence Solution?
Solution
x1 x2 x3

M ab bab bbaaa

N a ba bab

In this case, there is no solution because −


| x2x1x3 | ≠ | y2y1y3 | (Lengths are not same)
Hence, it can be said that this Post Correspondence Problem is undecidable.

You might also like