CT Test 2 Portion

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Chapter-II Decidability and Undecidability language

In this chapter, we will learn about the decidability and undecidability. In order understand
above mentioned terms the following definition needs to know.

Recursive language

The 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 are not in ‘L’.The turing machine will halt every
time and give an answer(accepted or rejected) for each and every string input.

Recursively Enumerable Language

The language L is said to be recursively enumerable language if there exists a Turing


machine (and therefore halt), which will accept all the input strings which are in ‘L’. But may
or may not halt for all input strings which are not in L

Decidable Language

A language ‘L’ is decidable if it is a recursive language. All decidable languages are


recursive language and vice versa.

Partial Decidable Language

A language ‘L’ is partial decidable language if it is a recursively enumerable language

Undecidable Language

A language ‘L’ is undecidable if it is not decidable. An undecidable language is sometimes


may partially decidable but not decidable. If a language is even not partially decidable, then
there exists no Turing machine for that language.

The above definitions are given in below table for quick understating.

Recursive language TM will always halt


Recursively Enumerable Language TM will halt sometime and may not halt
sometimes

Decidable Language Recursive language


Partially Decidable Language Recursively Enumerable language
Undecidable language No TM for that language
Language Decidability

A language is called Decidable or Recursive if there is a Turing machine which accepts and
halts on every input string w. Every decidable language is Turing-Acceptable.

A decision problem P is decidable if the language L of all yes instances to P is decidable. For
a decidable language, for each input string, the TM halts either at the accept or the reject state
as depicted in the following diagram:

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

Some more decidable problems are:


1. Does DFA accept the empty language?
2. Is L1∩ L2=Ø for regular sets?

Note:
1. If a language L is decidable, then its complement L' is also decidable.
2. If a language is decidable, then there is an enumerator for it.

Note:
1. If a language L is decidable, then its complement L' is also decidable.
2. If a language is decidable, then there is an enumerator for it.
The acceptance problem for DFAs of testing whether a particular deterministic finite
automaton accepts a given string can be expressed as a language, ADFA. This language
contains the encodings of all DFAs together with strings that the DFAs accept. Let
ADFA = { < B, w > | B is a DFA that accept s input string w }.
The problem of testing whether a DFA B accepts an input w is the same as the problem of
testing whether a <B,w> is a member of the language ADFA. Similarly we can formulate other
computational problem in terms of testing membership in a language.
In the following theorem we show that ADFA is decidable. Hence this theorem shows that the
problem of testing whether a given finite automaton accepts a given string is decidable.
Theorem 1.
ADFA is decidable language.
Proof Idea: we simply need to present a TM M that decides ADFA.
M= “ On input <B,w>, where B is DFA and w is a string.
1. Simulate B on input w.
2. If the simulation ends in an accept state, accept. If it ends in a non accepting state,
reject.”
Let’s examine the input <B,w>. it is a representation of a DFA B together with a string w.
one reasonable representation of B is simply a list of its five components, Q,,δ,q0 and F.
when M receives its input, M first determines whether it properly represents a DFA B and a
string w. if not, M rejects.
Then M carries out the simulation directly. It keeps track of B’s current state and B’s current
position in the input w by writing this information on the tape. Initially, B’s current state is q0
and B’s current input position is the leftmost symbol of w. The states and position are
updated according to the specified transition function δ. When M finishes the last symbol of
w, M accepts the input if B is in an accepting state; M reject the input if B is in a non-
accepting state.
We can prove similar theorem for nondeterministic finite automata. Let
ANFA = {< B, w > | B is a NFA that accept s input string w }.
Theorem 2.
ANFA is decidable language.
PROOF: we present a TM N that decides ANFA. We could design N to operate like M,
simulating an NFA instead of a DFA. Instead, we will do it differently to illustrate a new idea
have N use M as a subroutine. Because M is designed to work with DFA. N first converts the
NFA it receives as input to a DFA before passing it to M.
N= “On input <B,w> where B is a NFA and w is a string
1. Convert NFA B to an equivalent DFA C by using the procedure for this conversion.
2. Run TM M from Theorem 1 on input <C,w>.
3. If M is accepts, then string w is accepted. Otherwise rejected”.
Similarly, we can determine whether a regular expression generates a given string.
Let AREX = {<R,w> R is a regular expression that generates string w}.
Theorem 3.
AREX is decidable language.
PROOF: The following TM P decides AREX.
P=”On input <R,w> where R is a regular expression and w is a string.
1. Convert regular expression R to equivalent NFA A by using the procedure for this
conversion.
2. Run TM N on input <A,w>.
3. If N is accepts, then string w is accepted. Otherwise rejected”.
Theorem 1, 2 and 3 illustrate that, for decidability purposes, presenting the Turing machine
with DFA, NFA, or regular expression are all equivalent because the machine is able to
convert one form to another.
Now we turn to a different kind of problem concerning finite automata: emptiness testing for
the language of a finite automaton. In the preceding three theorems we had to determine
whether a finite automaton accepts a particular string. In the next proof we must determine
whether a finite automaton accepts any string at all.
Undecidable Language
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:
• The halting problem of Turing machine
• The mortality problem
• The mortal matrix problem
• The Post correspondence problem, etc.

Turing Machine Halting problem

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’ in a finite amount of time. If the halting machine
finishes in a finite amount of time, the output comes as ‘yes’, otherwise as ‘no’. The
following is the block diagram of a Halting machine:
Now we will design an inverted halting machine (HM)’ as:
If H returns YES, then loop forever.
If H returns NO, then halt.
The following is the block diagram of an ‘Inverted halting machine’:

Now we will design an inverted halting machine (HM)’ as:


If H returns YES, then loop forever.

If H returns NO, then halt.


The following is the block diagram of an ‘Inverted halting machine’:

Further, a machine (HM)2 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

Rice Theorem
Rice’s theorem states that, every non-trivial property of a recursively enumerable language is
undecidable.

Proof -A non-trivial property is one that is possessed by some objects of a class, but not all.
For example, being a mathematician is a property that is possessed by some humans but not

by all. Some cats are black but not all. So black colour property cannot be trivially
associated with cats.
Let χ be a non-trivial property that is not possessed by all recursively enumerable
languages. This problem can be reduced to one consisting of a pair (M, w) such that L
possesses χ iff w ∈ L(M ). We take a UTM U that takes a pair (M, w); its output is yes iff χ
is possessed by L.
Since L is a recursively enumerable language, there must be a TM, ML that accepts L. Let
x be a string belonging to L. Now, we design a machine M J to decide χ as shown below:

Here U is a UTM.
UTM, U takes the pair (M, w) and checks if w ∈ L(M ). If the output is yes, then the
machine ML that accepts the string x starts and the output of the machine M J is yes. Thus
the decidability of the problem of possessing the trivial property reduces to the problem
of Lu . If the pair (M, w) ∈ Lu , then L possesses χ ; otherwise not. Since Lu is not
recursive, possession of χ by L is also not decidable.

Post Correspondent problem.


The Post Correspondence Problem (PCP), introduced by Emil Post in 1946, is an undecidable
decision problem.
Definition of PCP

Let there be two series, x series and y series of size n with same charactere set Σ with
their ith element as xi and yi, respectively; does there exist a solution that forms the same x
series and y series?
The generic solution of PCP can be written as,
xi1 xi2 xi3.. xik = yi1 yi2 yi3 yik
Example 3:

Let there be two series of strings, say x series and y series as shown below:
i xi yi
1 10 101
2 01 100
3 0 10
4 100 0
5 1 010
Both X series and Y series contains 5 strings.
Let us call the strings in X
series as X substrings,
and the strings in Y series
as Y substrings.
If we concatenate X substrings x1x5x2x3x4x4x3x4,
we get 1010101001000100. If we concatenate
Y substrings y1y5y2y3y4y4y3y4, we get
1010101001000100. Let us call these strings as x
string and y string.
It can be seen that x string and y string are same.
Here we say that this instance of PCP has a solution in the form 15234434.

If we take 23,
x string is, x2x3 =010
y string is, y2y3 =10010.
Here x string and ys tring are different. Hence 23 is not a solution to this instance of PCP.
Example 4:

Find the solution to the instance of PCP given in the following table.
i xi yi
1 0 000
2 0100 01
0
3 01 1
Solution,
x2x1x1x3= 010000001
y2y1y1y3= 010000001

Hence, 2113 is a solution to this instance of PCP

Example 5:

Find why the instance of PCP given below cannot have a solution.
i xi yi
1 0 000
2 010 0100
3 01 100
4 11 110
It can be seen that for every pair, |xi| > |yi|.
So, in whatever way we concatenate the string, the length of the x string will be longer
than the corresponding y string. Thus there is no solution for this instance of PCP.

You might also like