0% found this document useful (0 votes)
271 views13 pages

Recursively Enumerable Sets and Turing Machines, Decidability

This document discusses Turing machines and their properties. It defines the components of a Turing machine as a tape, read/write head, and control unit. It describes how Turing machines can be modeled as 7-tuples and how they operate by reading/writing symbols and moving the head left/right based on their state. It defines the language accepted by a Turing machine and categorizes languages as Turing acceptable, decidable, and recursively enumerable based on whether a Turing machine can accept or decide them. It provides examples of Turing machines and the string classes they can accept, halt on, or get stuck in loops on.

Uploaded by

AKASH PAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
271 views13 pages

Recursively Enumerable Sets and Turing Machines, Decidability

This document discusses Turing machines and their properties. It defines the components of a Turing machine as a tape, read/write head, and control unit. It describes how Turing machines can be modeled as 7-tuples and how they operate by reading/writing symbols and moving the head left/right based on their state. It defines the language accepted by a Turing machine and categorizes languages as Turing acceptable, decidable, and recursively enumerable based on whether a Turing machine can accept or decide them. It provides examples of Turing machines and the string classes they can accept, halt on, or get stuck in loops on.

Uploaded by

AKASH PAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Chapter 3

Recursively Enumerable
Sets and Turing Machines,
Decidability

LEARNING OBJECTIVES

 Turing machines  Church’s hypothesis


 Model of turing machine  Halting problem
 Types of turing machines  Post’s correspondence problem
 Offline turing machine  7 P problems
 Universal turing machine  NP problems
 Recursively enumerable languages  NP – complete problem
 Recursive language  NP – hard problem
 Undecidability  Closure properties of formal languages

turing Machines Model of Turing Machine


Tape (No boundaries Infinite length)
L Recursively
enumerable
language
At each step,
Unrestricted
*Reads a symbol
grammar Read - write Head
Accept *writes a symbol
(movement in both *moves left or right
directions) or doesn’t move

Turing
machine

Control unit
A Turing machine is a kind of state machine, which is much more
powerful in terms of languages it can recognize. At any time, the
machine is in any one of the finite number of states. Instructions
for a turing machine include the specification of conditions, under
which the machine will make transitions from one state to other.
5.38 | Unit 5  •  Theory of Computation

•• A TM (turing machine) consists of Tape, Head, control unit. 2. LOOP (TM):  It is the set of all strings, w ∈ ∑* ∋ if
•• Tape: A tape is divided into a sequence of numbered the tape initially contains w and the TM is then run,
cells, Each cell contains a symbol and cells that have not then the TM loops forever (infinite loop).
been written before are assumed to be filled with a blank 3. Reject (TM):  It is the set of all strings w ∈ ∑* ∋, any
symbol (B). The set of symbols of tape is denoted by . of the following 3-cases arise.
The tape is assumed to be arbitrarily extensible to the left
Case I:  T here may be a state and a symbol under the tape
as well as to the right.
head, for which δ does not have a value.
•• Head: In a single step, a tape head reads the contents of a
Case II:  If the head is reading the left most cell (i) contain-
cell on the tape (reads a symbol), replaces it with some other
ing the symbol x, the state of TM is say q, then δ
characters (writes a symbol) and repositions itself to the
(q, x) suggests a move to the left of the current
next cell to the right or to the left of the one it has just read
cell. However as there is no cell to the left, no
or does not move (moves left or right or does not move).
move is possible.
•• Control unit: The reading from the tape or writing into
Case III: If TM enters an infinite loop or if a TM rejects a
the tape is determined by the control unit. It contains a
given string w, because of above two cases, TM
finite set of states, Q. The states are:
crashes (terminates unsuccessfully).
1. Initial state, q0
2. Halt state, h: This is state in which TM stops all
further operations. There can be one or more halt Languages Accepted by a TM
states in a TM.
3. Other states. •• The language accepted by TM is the set of accepted
strings w ∈ ∑*.
Note:  A TM on entering the halt state stops making moves
•• Formally, let M = (Q, ∑, , δ, q0, B, h) be a TM. The lan-
and whatever string is there on the tape, will be taken as the
guage accepted by M denoted by L(M) is defined as, L(M)
output, irrespective of whether the position of head is at the
= {w/w∈ z* and if w = a1… an then, (qo, ε, a1, a2, …an) (h,
end or in the middle of the string on the tape.
b, …, bi-1, bj bn) for some b1, b2 … bn ∈ N* ∋}
Transition Diagram of TM L(M) = {W: qo w ├ *x1hx2}
•• There are three types of turing machine related
Reads a symbol
a → b, L languages:
p q writes a symbol
Turing Acceptable language: A language, L over
1.
Move Right (R)
a → b, R some alphabet is said to be turing acceptable language
p q Move Left (L) if there exists a TM, M ∋ L = L(M )
No Move (N) Turing Decidable Language: A language L over
2.
∑ i.e., L ⊆ ∑* is said to be turing decidable, if both
Specification of TM languages, L and its complement ∑* - L are turing
acceptable.
5-Tuple specification:
Recursively Enumerable Language: A language L
3.
TM = (state1, Read symbol, write symbol, L/R/N, state 2).
is recursively enumerable, if it is accepted by a TM.
7 - Tuple specification of TM:
A TM, M is represented as a 7-tuple: Example 1:  Let M be a turing machine has M = (Q, , ∑,
M = (Q, ∑, , δ, q0, B, h) where δ, S, B, F ) with Q = {qo, q1, q2, q3, q4}, ={a, b, X, Y, #},
Q → Finite set of states ∑ = {a, b}, S = q0, B = #, δ given by:
∑ → Finite set of non-blank symbols
 → Set of tape characters a b X Y #
qo → qo ∈ Q, initial state q0 (q1, X, R) - - (q3, Y, R)
B → Blank character q1 (q1, a, R) (q2, Y, L) - (q1, Y, R)
h → h ⊆ Q, final state
q2 (q2, a, L) - (q0, X, R) (q2, Y, L)
δ → Transition function, Q ×  → Q ×  x {L, R, N}
q3 - - - (q3, Y, R) (q4, #, R)

String classes in TM q4 - - - - -

Every TM, over the alphabet ∑, divides set of input string w Which of following is true about M ?
into three classes: (A) M halts on L having ‘baa’ as substring
1. Accept (TM):  It is the set of all strings w ∈ ∑* ∋ if the (B) M halts on L having ‘bab’ as substring
tape initially contains w and the TM is then run, then (C) M halts on L = {an bn/n ≥ 1}
TM ends in a halt state. (D) M halts on L not having ‘bbaa’ as substring.
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.39

Solution:  (C) Non-deterministic turing machines


M accepts an bn. •• A non-deterministic turing machine is a device with a
Example:  aaabbb finite control and a single one way infinite tape.
(q0, ∈, aaabbb) → (q1, XXXYY, b) •• For a given state and a tape symbol scanned by the tape head,
(q1 X, aabbb) → (q2 XXXY, YY) the machine has a finite number of choices for next move.
(q1, Xa, abbb) → 1
(q2, XXX, YYY ) Note: Non-deterministic TM is not permitted to make a
(q1, Xaa, bbb) → (q2, XY, XYYY ) move in which the next state is selected from one choice,
(q1, Xa, aYbb) → (q0, XXX, YYY ) and the symbol printed and direction of head motion are
(q2, X, aaYbb) → (q3, XXXY, YY ) selected from other choices.
(q2, ∈, XaaYbb) → (q3, XXXYY, Y ) •• The non-deterministic TM accepts its input if any
(qo, X, aaYbb) → (q3, XXXYYY, ∈) sequence of choices of moves leads to an accepting state.
(q1, XX, aYbb) → (q4, XXXYYY#, ∈)
Multi-dimensional TM’s
Types of Turing Machines Finite
control
Two-way infinite turing machine
Finite control

a1 a2 ai an B

•• A TM with a two-way infinite tape is denoted by M = (Q,


•• The tape consists of a k-dimensional array of cells infinite
∑, , δ, qo B, F), as in original model.
in all 2k directions, for some fixed k.
•• The tape is infinite to the left as well as to the right.
•• Depending on the state and the symbol scanned, the
If δ(q, x) = (p, Y, L) then q x a ├ m pBY. The tape, is device changes it’s state, prints a new symbol and moves
infinte towards left. its tape head in one of the 2k directions, either positively
If δ (q, x) = (p, B, R) then q x a ├ m , pa the is infinite or negatively, along one of the k-axes.
towards right.
Multihead TM
Multiple turing machines Finite control

1 2 3 k
Finite
control
B

•• A K-head TM has some fixed ‘K’ number of heads. The


heads are numbered from 1 through k, and a move of the TM
depends on the state and on the symbol scanned by each head.
•• A multiple TM consists of a finite control with k tape heads
and k-tapes, each tape is infinite in both directions, on a Offline turing machine
single move, depending on the state of the finite control Finite control
and the symbol scanned by each of tape heads, the
machine can,
•• change state $
C
•• print new symbol on each of the cells scanned by its
tape head
•• move each of its tape heads, independently, one cell to
the left or right or keep it stationary.
•• Initially, the input appears on the first tape and other tapes
are blank.
5.40 | Unit 5  •  Theory of Computation

•• An offline TM is a multi tape TM, whose input tape is Combining turing machines
read only. The input is surrounded by end markers, ¢ on If TM1 and TM2 are turing machines, then we can combine
left and $ on right. The TM is not allowed to move the these machines and create a Turing machine which will first
input tape head off the region between ¢ and $. behave like TM1 and TM2.
  To combine two turing machines follow below steps:
Multi stack machine
1. Change all states in TM2, so that they do not conflict
•• A deterministic two stack machine is a deterministic TM with the state names in TM1.
with a read only input and two storage tapes. 2. Change all halts in TM1’s transition table to the new
name of the start state of TM2.
Note: 3. Append TM2’s transition table to the foot of TM1’s
•• All these types of TM’s does not add any language transition table.
accepting power and all these are equivalent to the basic •• If TM1 and TM2 are combined in this way, we will write
model. it as TM1 → TM2.
•• Any language accepted by a 2-PDA can be accepted by
some TM and any language accepted by a TM can be So this new machine starts off in the initial state of TM1,
accepted by some 2-PDA. Accepting power of a TM = operates as per TM1 until TM1 would halt then it launches
accepting power of a computer. TM2 and operates a TM2, until TM2 would halt.
•• Any language accepted by a PDA with n stacks (n ≥ 2),
can also be accepted by some TM.
Recursively Enumerable languages
Example 2:  Consider the following statement about L:
1. L is accepted by multi-tape turing machine M1. •• A language L over the alphabet ∑ is called ‘recursively
2. L is also accepted by single tape turing machine M2. enumerable’ if there is a TM, M that accept every word in
L and either rejects or loops for every word in language
Which of following statement is correct? L′, the complement of L.
(A) Acceptance by M2 is slower by O (n2) Accept (M) = L
(B) Acceptance of M2 is slower by O (n) Reject (M) + Loop (M) = L′.
(C) Acceptance of M2 is faster by O (n) •• When TM, M is still running on some input of recursively
enumerable languages, it is not decided that M will even-
(D) Acceptance of M2 is faster by O (n2)
tually accept, if let it run for long time or M will run for-
Solution:  (A) ever (in loop).
While simulating multi-tape TM on a single tape TM the Recursive language
head has to move at least 2k cells per move, where k is the
•• A language is said to be recursive, if there exists a TM
number of tracks on single tape TM. Thus for k moves,
which will halt and accept when presented with any input
∑ i =1 2i = 2k 2.
k
string w ∈∑*, only if the string is in the language other-
Which means quadratic slow down? wise will halt and reject the string.
Thus, acceptance of multi-tape is faster by O(n2). •• Thus, for turing decidable language L, there is a TM
which halts for a large number of inputs w belonging to L.
•• A TM that always halts is known as a decider or a
Universal turing machine
total turing machine and is said to decide the recursive
A Universal turing machine is a turing machine that can language. The recursive language is also called as recur-
simulate an arbitrary turing machine on arbitrary input. sive set of decidable.
•• The machine consists of an input output relation to the •• A language accepted by a TM is said to be recursively
machine computes. enumerable language. The subclass of recursively enu-
merable sets are said to be recursive sets or recursive
•• The input is given in binary form on the machine tape and
language.
the output consists of the contents of the tape when the
machine halts. Note:
•• The contents of the tape will change based on the Finite •• All recursive languages are also recursively enumerable.
State Machine (FSM) inside the TM. •• There may be languages which are recursively enumer-
•• The problem with TM is that a different machine will be able but not recursive.
constructed for every new computation to be performed. •• Set of all possible words over the alphabet of the recur-
•• A UTM can simulate any other machine. sive language is a recursive set.
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.41

•• Set of all possible words, over the alphabet of the recur- •• These languages cannot be defined by any effective
sive enumerable language, is a recursively enumerable set. procedure.
For any non-empty ∑, there exist languages that are not
Recursively Enumerable.
Infinite table for all i and j is:
Recursively enumerable
j →
1 2 3 4
Recursive 0 1 1 0
1

2 1 1 0 0
RE but not recursive
i 3 0 0 1 0

Not recursively enumerable 1


4 0 1 0

Figure 1  Relationship between the recursive, Diagonal


RE and non-RE languages.
To guarantee that no TM accepts Ld:
wi is in Ld if and only if the (i, i) entry is 0, that is, if Mi
Properties of Recursive and does not accept wi.
Suppose that some TM Mj accepted Ld. Then it contra-
Recursively Enumerable Languages dicts if wj is in Ld, ( j, j) entry is 0, implying that wj is not in
L (Mi) and contradicting Ld = L (Mi).
•• If a language L is recursive, then there is a TM T that
If wi is not in Ld, then the (  j, j) entry is 1, implying that
accepts it and always halts.
wi is in L(Mj), which again contradicts Ld = L(Mj), as wj is
•• If L and LI are both recursively enumerable, then L and LI
either in or not in Ld, assumption, Ld = L(Mj) is false.
are recursive.
Thus no TM in the list accepts Ld, Hence Ld is non-
•• Union of two recursive languages is recursive.
recursively enumerable language.
•• Recursively enumerable languages are closed under union.
•• If L, L1 and L2 are recursive languages, then so are L1 ∪ Decidable:  A problem with two answers (Yes/No) is decid-
L2, L ∩ L2, L1L2, L*, L1 ∩ L2 and L1 - L2. able if the corresponding language is recursive.
•• If L, L1 and L2 are recursively enumerable languages, then Example: 
so are L1 ∪ L2, L*, L1 ∩ L2, L1L2.
•• If ∑ is an alphabet, L ⊆ ∑*, is a recursively enumerable 1. ADFA = {(M, w) M accepts the input string w}.
language and ∑* – L is recursively enumerable, then L is •• A Language L is turing decidable, if there exists a TM
recursive. M such that on input x, M accepts if x ∈ L and M rejects
otherwise. L is called undecidable if it is not decidable.
Example 3: If ∑ = {0,1}, the canonical order is •• Decidable Languages correspond to algorithmically
{∈,0,1,00,01,10,11,000,…} where w is the ith word and Mj solvable Decision problems.
is TM whose code is the integer j, written in binary. The •• Undecidable language corresponds to algorithmically
language generated is L(Mj). The diagonalized language, Ld unsolvable decision problems.
is a.
(A) Recursively enumerable language but not recursive Closure properties of decidable languages
(B) Recursive language •• Decidable Languages are closed under complement, union,
(C) Non-recursively enumerable language intersection, concatenation and star (closure) operations.
(D) Both (a) and (c)
Note 1: A language is decidable if both the language and its
Solution:  (C) complement are recognizable.
Non-recursively enumerable language.
Note 2: Turing Decidable languages are Recursive languages.

Non-recursively enumerable language


Undecidability
Non-Recursively Enumerable Language: A language
There are problems that can be computed. There are also
which is not accepted by any turing machine is non-recursively
problems that cannot be computed. These problems which
enumerable.
cannot be computed are called ‘computationally undecid-
Example:  Power set of an infinite set. able problems’.
5.42 | Unit 5  •  Theory of Computation

Church’s Hypothesis T halt for


M1 input t = dT
There is an assumption that the intuitive notion of com- dT Loops
putable functions can be identified with partial recursive Copy T dT , dT → Modified
Input
functions. Halt T does not
halt for
However, this hypothesis cannot be proved. The computa- t = dT
bility of recursive function is based on following assumptions:

1. Each elementary function is computable. Replace T by M2 i.e., M2 = T


2. Let ‘f  ’ be a computable function and ‘g’ be another
function which can be obtained by applying an M 2 halt for
elementary operation to f, then g becomes a comput­ M2 input dM 2
able function. dT Loops
3. Any function becomes computable, if it is obtained (Input)
by rule (1) and (2). Halt

Undecidability of the universal languages That’s means, a machine M1, which can tell whether any
•• The universal language, Lu is a recursively enumerable other TM will halt on particular input does not exist. Hence
language but not recursive. halting problem is unsolvable.

Hypothetical TM Yes Accept


Post’s Correspondence Problem (PCP)
M for Lu No Reject The Undecidability of strings is determined with the help of
Post’s Correspondence Problem (PCP).
‘The PCP consists of two lists of strings that are of equal
length over the input ∑. The two lists are A = w1, w2, w3, …
Halting Problem wn and B = x1, x2, … xn then there exists a non-empty set of
The given configuration of TM is required to state halting integers i1, i2, … in such that w1, w2, … wn = x1, x2, … xn’.
problem. The output of TM can be: To solve PCP, try all the combinations of i1, i2, … in to
find the wi = xi then, PCP has a solution.
1. Halt:  The machine starting at this configuration will
halt after a finite number of states. Example 4:  What is the solution for the following system
of post correspondence problem. A = {100, 0, 1} B = {1,
2. No Halt:  The machine starting at this configuration 100, 00}
never reaches a halt state, no matter how long it runs. (A) 1113322 (B) 1311322
(C) 2233111 (D) No solution
•• The halting problem is unsolvable because, let, there
exists a TM, M, which decides whether or not any com- Solution:  (B)
putation by a TM, T will ever halt when a description dT The string is:
of T and tape t of T is given. That means the input to A1A3A1A1A3A2A2 = 100 + 1 + 100 + 100 + 1 + 0 + 0 =
machine M, will be (machine, tape) pair. Then for every 1001100100100,
input (t, dT ) to MI if T halt for input t, MI also halts which B1B3B1B1B3B2B2 = 1 + 00 + 1 + 1 + 00 + 100 + 100 =
is called accept halt. 1001100100100.
Similarly if T does not halt for input t then the M1 will
halt which is called reject halt.
Problems
When •• P stands for deterministic polynomial time. A deterministic
M1 T halt for t
machine at each time executes an instruction. Depending
Accept halt
(t, dT ) on instruction, it then goes to next state which is unique.
Input
Reject halt Hence, time complexity of deterministic TM is the maxi-
When mum number of moves made by M in processing an input
T does not
halt for t string of length n, taken over all inputs of length n.
•• A language, L is said to be in class P, if ∃ a (determinis-
•• Consider another Turing Machine, M2 which takes an tic) TM, M is of time complexity P (n) for some polyno-
input dT . It first copies dT on its tape and then this dupli- mial P and M accepts L.
cated tape information is given as input to M1. But M1 is •• Class P consists of those problems that are solvable in
a modified machine. polynomial time by a deterministic TM.
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.43

NP Problems NP-Hard Problem


•• NP stands for non-deterministic polynomial time.
•• A language, L is in class NP, if there is a non-deterministic
TM, M is of time complexity P(n) for some polynomial P
NP - hard
P and M accepts L. NP
•• Class NP consists of problems for which solutions are
verified quickly. P consist of problems which can be
solved quickly. NP - complete
NP •• A problem that is NP-hard has a property that all problems
P that are in NP can be reduced in polynomial time to it.
•• A language, L in NP-hard complete if and only if,
Condition 1:  For every language, LI in NP, there is a poly-
nomial time reduction of LI to L.
•• NP languages are closed under union, Intersection, con-
catenation, Kleen star. Condition 2: L is not necessarily in NP.
•• NP problems are classified into two types: Table 1  NP-Hard versus NP-complete problems:
1. NP-complete
NP-Hard NP-Complete
2. NP-hard problems.
(1) A decision problem Pi is (1) A Decision problem Pi is
Example:  Vertex (Graph) coloring problem, Travelling NP-hard if every problem NP-complete if it is NP-hard
salesman problem, the vertex cover problem, the Hamiltonian in NP is polynomial time and is also in class NP itself.
circuit problem. reducible to Pi.
(2) In terms of symbols ‘Pi’ (2) In terms of symbols, ‘Pi’ is
NP-Complete Problem is NP-hard if for every Pj
→ NP
NP-complete, if Pi is NP-hard
and Pj → NP
•• A class of problems are known as NP-complete problems
(3) Pi is ‘as hard as’ all the (3) Pi is one of the hardest prob-
whose status is unknown. No polynomial time has yet problem in NP lems in NP
been discovered for NP-complete problems nor has any
(4) If any problem in NP (4) If any one ever shows that
one been able to prove that no polynomial time exists for is proved intractable, as NP-complete problem is
any of them. These are hardest of NP-problems. The P then Pi must also be also intractable, then every
and NP-complete problems are disjoint. intractable NP-complete problem is also
intractable.
Example: (Cook’s Theorem) SAT is NP-complete, Bin
packing problem, Knapsack Problem. Example 5:  Which of following is FALSE?
•• A language L is said to be NP-complete if L ∈ NP and if (A) {< x, y > | x and y are integers, gcd (x, y) = 1} is a NP
every LI ∈ NP is polynomial-time reducible to L. class problem.
(B) CLIQUE is a NP class problem.
A language L1 is said to be polynomial time reducible to
(C) Eulerian PATH is a P class problem
some language L2 if there exists a DTM by which any w1 in
(D) Dijkstra’s algorithm is a problem in P.
the alphabet of L1 can be transformed in polynomial time to
a w2 in the alphabet of L2 in such a way that w1 ∈ L1 if w2 Solution:  (A)
∈ L2. It follows that if some L1 is NP-complete and polyno- Choice (A) is a P class problem.
mial time reducible to L2, then L2 is also NP-complete. Consider the following table:

D – Decidable, U – Undecidable,? – Open Recursive Recursively


question,T – Trivially Decidable Question Regular Sets DCFL’s CFL’s CSL’s Sets Enumerable Sets
(1) Membership problem? D D D D D D
(2) Emptiness problem? D D D U U U
(3) Completeness problem is L = ∑*? D D D U U U
(4) Equality problem? D ? U U U U
(5) Subset problem is L1 ⊆ L2? D U U U U U
(6) Is L Regular? T D U U U U
(7) Is the intersection of two languages, a lan- T U U T T T
guage, of the same type?
(8) Is the complement of a language, also a lan- T T U ? T U
guage of the same type?
(9) Is L is finite or infinite? D D D U U U
5.44 | Unit 5  •  Theory of Computation

Table 2  Closure properties of formal languages

Recursively
Regular sets DCFL’S CFL’S CSL’S Recursive sets enumerable sets
(1) Union Y N Y Y Y Y

(2) Concatenation Y N Y Y Y Y

(3) Kleen star Y N Y Y Y Y

(4) Intersection Y N N Y Y Y

(5) Complementation Y Y N Y Y N

(6) Homomorphism Y N Y N N Y

(7) Inverse Homomorphism Y Y Y Y Y Y

(8) Reversal Y N Y Y Y Y

(9) Substitution Y N Y Y N Y

(10) Intersection with regular ets Y Y Y Y Y Y

Exercises
Practice Problems 1 4. A language is given as INFINITEDFA= {<A>: A is a
Directions for questions 1 to 15:  Select the correct alterna- DFA and L (A) is an infinite language}. Which of fol-
tive from the given choices. lowing is true?
(A) Un-decidable (B) Decidable
1. The TM M over ∑ = {1} is given below (C) Trivially decidable (D) None of above.
1/1, R 5. A TM designed over an alphabet {0, 1, #}, where 0
1/1, R indicates blank, which takes a non-null string of 1’s and
b/1, R q1 #‘s and transfer’s the right-most symbol to the left-most
q0 b/b, L end contains-states. (Ex: 000#1#1#1000 … becomes
b/b, L
0001#1#1#000)
q2 (A) 4 (B) 3
(C) 6 (D) 5.
1/b, L 6. Which of following statements are true?
q3 (i) Let K, L be decidable languages. The concatenation
q4
b/b, R 1/1, L of languages, K, L is also decidable language.
(ii) Let L be Turing recognizable language. Then the
What does M generate? complement, L1 is also Turing recognizable language.
(A) The output is total recursive multiplication (A) (i) and (ii) (B) Only (ii)
function. (C) Both are false (D) Only (i)
(B) The output is addition of two integers. 7. Let Ti: denote i th TM. Given, X determines whether X∈
(C) The output is subtraction of two integers. S, Where the set S is defined inductively as follows: If
(D) The output should be w1w2 if input = (w1w2) a pair u ∈ S, then u2 + 1, 3u + 2 and u! are all members of
of words. S. Which of following is true about the given decision
2. Consider language, problem?
(A) Decidable (B) Un-decidable
A = {<M>: M is a DFA which doesn’t accept any string
(C) Trivially decidable (D) No solution.
containing odd number 1’s}
8. Fermat’s last theorem asserts that there are no integer
Which of following is true about A?
solution (x, y, z, n) to equation xn + yn = zn satisfying x, y
(A) A is Trivially decidable (B)  A is undecidable
> 0 and n > 2. Which of the following is true regarding
(C) A is decidable (D)  None of these
the halting problem?
3. Consider EQCFG= {<G1G2>: G1, G2 are CFGs and L (G1) (A) Decidable
= L (G2)}. Which of following is true about EQCFG? (C) Un-decidable
(A) Recognizable (B) Co-Recognizable (C) Trivially decidable
(C) Un-recognizable (D) None of the above. (D) May or may not have solution.
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.45

9. The TM, T is designed as 11. Consider three problems, P1, P2 and P3. It is known that
0/0, R P1 has polynomial time solution, P2 is NP-complete
0/x, R 0/x, R
q0 q1 q2 y/y, R and P3 is in NP. Which one of the following is true?
y/y, R (A)  P3 has polynomial time solution if P1 is polyno-
x/x, R 1/y, L mial time reducible to P3.
q5
B y/y, L (B)  P3 is NP-complete if P3 is polynomial time reduc-
B x/x, L ible to P2.
y/y, R q4 q3
0/0, L (C) P3 is NP complete if P2 is reducible to P3
q6
(D)  P3 has polynomial time complexity and P3 is re-
ducible to P2.
Which of following is true? 12. Let FHAM be the problem of finding a Hamiltonian
(A) T halts on 0n1n, n ≥ 0 cycle in a graph G and DHAM be the problem of deter-
(B) T halts on (01) (0n 1n), n ≥ 0 mining if a Hamiltonian cycle exists in a graph. Which
2 2
(C) T halts on 0 n 1n , n ≥ 0 one of the following is true?
(D) T halts on 02n1n , n ≥ 0 (A) Both FHAM and DHAM are NP-hard.
10. Design TM, which reads an input and starts inverting (B) FHAM is NP-hard, but DHAM is not.
0’s to 1’s till the first 1. The first 1 also inverted. After it (C) DHAM is NP-hard but FHAM is not.
has inverted first 1, it read the next symbols and keeps (D) Neither DHAM nor FHAM is NP-hard.
them as they are till the next 1. After encountering 1, it
starts repeating the cycle by inverting the symbol till 13. The solution for the system of post correspondence
next 1. It halts when it encounters a blank symbol? problem, A = {ba, abb, bab}, B = {bab, bb, abb} is
(A) 1312212 (B) 15234434
(A) q0 0/1, R
q1 (C) 1311322 (D) No solution.

1/0, R 14. A language, prefix_free REX = {R/R is a regular


B/B, R expression where L(R) is prefix_free}. Which of fol-
lowing is true about prefix _free REX?
(A) Decidable
q2
(B) Un-decidable
(B) 0/0, R 0/0, R
(C) Trivially decidable.
1/1, R
(D) Can’t be determined.
q0 q1
15. The TM, M is designed as:
1/1, R

B/B, R B/B, R x → x, R x → x, R

* → *, R b → x, R
q2 0 1 2

a → x, R c → x, R
(C) 1/0, R 1/1, R
0/1, R * → *, R a → a, R
q0 q1
6 3

b → x, R c → x, R
0/0, R c → x, R
B/B, R 8 7 4
b → b, R

a → a, L B → B, R
q2 c → c, L
b → b, L 5
(D) 0/1, R 0/0, R x → x, L
1/0, R
q0 q1
Which of following is true about M?
1/1, R
M is designed for a n b n c n, n ≥ 0
(A)
B/B, R B/B, R 2 3 4
M is designed for a n b n c n , n ≥ 0
(B)
q2 M is designed for an bn+1 cn+2, n ≥ 0
(C)
(D)
M is designed for an bn cn, n > 0
5.46 | Unit 5  •  Theory of Computation

Practice Problems 2 b/1, R


Directions for questions 1 to 15:  Select the correct alterna-
q0 q1 1/1, R qf
tive from the given choices. 1/1, L
1. Consider the language, Aε–CFG = {<G>: G is a CFG that b/1, L
generatesε}. Which of the following is true?
(A) 7 (B) 6
(A) Undecidable
(C) 5 (D) 4
(B) Decidable
(C) Trivially decidable. 7. L contains at least two strings. Which of following is
(D) None of the above. true?
(A) L has recursively enumerable sets and recursive.
2. The TM is designed with input and output as binary (B) L is recursive.
form. (# represents blank). The turing machine TM (M) (C)  L has recursively enumerable sets but not recursive.
is (D)  L does not contain recursively enumerable sets and
also is not recursive.
0 1 #
8. Consider the following TM:
q0 (q1, 0, R) (q, 1, R) φ
q1 (q1, 0, R) (q, 1, R) (q2, #, L)
Input
q2 (q3, #, L) (q3, #, L) φ
State 0 1 B
q3 (q3, 0, L) (q3, 1, L) (q4, #, L) (q0, 1, R) (q0, 0, R) (q1, B, R)
→ q0
q4 φ φ φ
q1 – – –
Which of following is true?
(A) M accepts 2n What does TM generates?
(B) M accepts n2 (A) It display’s the negative of given binary number.
(C) M replaces left most symbol with # (B) It computes one’s complement of a binary number.
(D) M replaces right most symbol with # (C) It computes two’s complement of a binary number
(D) It generates double the 0’s as 1’s.
3. The TM is designed with 3-characters 0, 1, # to com-
pute function f (n) = 2n. Input and output are to be in 9. Consider the following TM, M:
binary form and string represented by ‘n’ is enclosed
a/a, R
between two #’s on left and right of it. b is blank
symbol. TM contains _____ states. B/B, R q0 a/B, R q1
q4
b/b, R
(A) 4 (B) 3
(C) 2 (D) 1
B/B, L
4. The language {1n | n is a prime number} is B/B, R
(A) Undecidable
(B) Decidable
(C) Trivially decidable b/b, R
q3 q2
(D) None of the above b/B, L
5. Which of following statement(s) are true? a/a, L
(i) Let L be Turing decidable language. Then the com-
plement L is also Turing decidable language. Which of following is true?
(ii) Let K and L be two Turing recognizable languages. (A) M halts on an+12 bn, 3n ≥ 0.
The intersection, K ∩ L is also Turing recognizable (B) M halts on a , b n ≥ 0.
n n

language. (C) M halts on (ab) (an), n ≥ 0.


(A) Both (i) and (ii) (D) M halts on an bn, n ≥ 0.
(B) Only (i) 10. A TM, M is designed generates language
(C) Only (ii)
L = {a n b m : n ≥ 1 and n ≠ m}. The number of states
(D) Neither (i) nor (ii) are true.
used are ________
6. For the following two-way infinite TM, the equivalent (A) 5 (B) 6
one-way TM contains _____ states. (C) 7 (D) 4
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.47

11. Consider three decision problems p1, p2 and p3. It is (A) 1312213 (B) 2113
known that p1 is decidable, p2 is undecidable. Which (C) 3112 (D) No solution.
one of following is true? 14. Given a Turing machine M, a state ‘q‘and a string ‘w’.
(A) p3 is decidable if p1 is reducible to p3 To determine whether M ever reaches state q when
(B) p3 is undecidable if p3 is reducible to p2 started with input w from its initial state is?
(C) p3 is undecidable if p2 is reducible to p3 (A) Decidable
(D) p3 is decidable if p3 is reducible to p2’s complement. (B) Un-decidable
12. Which one of following is not decidable? (C) Trivially decidable.
(A) Given a TM, M, a string S, and an integer K, M ac- (D) Can not be determined.
cepts S with in K-steps. 15. Given a Turing machine, M to determine whether M ever
(B) Equivalence of two given Turing machines. moves its head to the left when started with input W is:
(C) Language accepted by a given DFSA is non-empty. (A) Decidable
(D) Language accepted by a CFG is non-empty. (B) Un-decidable
13. What is the solution for the correspondence system (C) Trivially decidable.
with two lists x = {b, bab3, ba} and y = {b3, ba, a} (D) Can not be determined.

Previous Years’ Questions


1. For s ∈ (0 + 1)*, let d(s) denote the decimal value of (A) L2 – L1 is recursively enumerable
s (e.g., d (101) = 5).[2006] (B) L1 – L3 is recursively enumerable
Let L = {s ∈ (0 + 1)*|d(s) mod 5 = 2 and d(s) mod 7 ≠ 4} (C) L2 ∩ L1 is recursively enumerable
(D) L2 ∪ L1 is recursively enumerable
Which one of the following statements is true?
(A) L is recursively enumerable, but not recursive 6. Which of the following statements is/are FALSE?
(B) L is recursive, but not context-free  [2013]
(C) L is context-free, but not regular 1. For every non-deterministic Turing machine, there
(D) L is regular exists an equivalent deterministic Turing machine.
2. Turing recognizable languages are closed under un-
2. Which of the following is true for the language {ap | p
ion and complementation.
is a prime}? [2008]
3. Turing decidable languages are closed under inter-
(A) It is not accepted by a Turing Machine
section and complementation.
(B) It is regular but not context-free
4. Turing recognizable languages are closed under
(C) It is context-free but not regular
union and intersection.
(D) It is neither regular nor context-free, but accept-
(A) 1 and 4 only (B) 1 and 3 only
ed by a Turing machine
(C) 2 only (D) 3 only
3. If L and L are recursively enumerable then L is [2008]
7. Let L be a language and L be its complement. Which
(A) regular
one of the following is NOT a viable possibility?
(B) context-free
(C) context-sensitive [2014]
(D) recursive (A) Neither L nor L is recursively enumerable (r. e)
4. Let L = L1 ∩ L2, where L1 and L2 are languages as (B) One of L and L is r.e. but not recursive, the other
defined below: is not r. e.
L1 = {a m b m c a n b n | m, n ≥ 0} (C) Both L and L are r.e. but not recursive
(D) Both L and L  are recursive
L2 = {ai b j c k | i, j , k ≥ 0}
8. Let A ≤m B denotes that language A is mapping reduc-
Then L is [2009] ible (also known as many-to-one reducible) to lan-
(A) Not recursive
guage B. Which one of the following is FALSE?
(B) Regular
(C) Context free but not regular [2014]
(D) Recursively enumerable but not context free. (A) If A ≤m B and B is recursive then A is recursive.
(B) If A ≤m B and A is undecidable then B is undecid-
5. Let L1 be a recursive language. Let L2 and L3 be
able.
languages that are recursively enumerable but not
recursive. Which of the following statements is not (C) If A ≤m B and B is recursively enumerable then A
necessarily true? [2010] is recursively enumerable.
5.48 | Unit 5  •  Theory of Computation

(D) If A ≤m B and B is not recursively enumerable III. L*1 ∩ L2 is context - free
then A is not recursively enumerable. IV. L1 ∪ L 2 is context - free
9. Let <M> be the encoding of a Turing machine as a (A) I only (B) I and III only
string over ∑ = {0, 1}. Let L = {<M>|M is a Turing (C) I and IV only (D) I, II and III only
machine that accepts a string of length 2014}. Then, L 14. Consider the following languages. [2016]
is
L1= {<M> | M takes at least 2016 steps on some
(A) Decidable and recursively enumerable input},
(B) Undesirable but recursively enumerable L2= {<M> | M takes at least 2016 steps on all inputs}
(C) Undesirable and not recursively enumerable and
(D) Decidable but not recursively enumerable L1= {<M> | M accepts e}
10. For any two languages L1 and L2 such that L1 is con- where for each Turing machine M, <M> denotes a
text-free and L2 is recursively enumerable but not specific encoding of M. Which one of the following is
recursive, which of the following is/are necessarily TRUE?
true? [2015] (A) L1 is recursive and L2, L3 are not recursive
 I.  L1 (complement of L1) is recursive (B) L2 is recursive and L1, L3 are not recursive
 II.  L 2 (complement of L2) is recursive (C) L1, L2 are recursive L3 is not recursive
(D) L1, L2, L3 are recursive
III.  L1 is context-free
 IV.  L1  ∪ L2 is recursively enumerable 15. Let A and B be finite alphabets and let # be a symbol
outside both A and B. Let f be a total function from A*
(A) I only (B) III only
to B*. We say f is computable if there exists a turning
(C) III and IV only (D) I and IV only
machine M which given an input x in A*, always halts
11. Consider the following statements. with f(x) on its tape. Let Lf denote the language {x #
 I. The complement of every Turning decidable lan- f(x)| x ∈ A*}. Which of the following statements is
guage is Turing decidable. true: [2017]
 II. There exists some language which is in NP but is (A) f is computable if and only if Lf is recursive.
not Turing decidable. (B)  f is computable if and only if Lf is recursively
enumerable.
III. If L is a language in NP, L is Turing decidable.
(C) If f is computable then Lf is recursive, but not
Which of the above statements is/are true? [2015] conversely.
(A) Only II (B) Only III (D) If f is computable then Lf is recursively enumer-
(C) Only I and II (D) Only I and III able, but not conversely.
12. Let X be a recursive language and Y be a recursively
16. Let L(R) be the language represented by regular
enumerable but not recursive language. Let W and Z
expression R. Let L(G) be the language generated by
be two languages such that y reduces to W, and Z
a context free grammar G. Let L(M) be the language
reduces to x (reduction means the standard many-
accepted by a Turing machine M. Which of the fol-
one reduction). Which one of the following state-
lowing decision problems are undecidable? [2017]
ments is TRUE? [2016]
I. Given a regular expression R and a string w, is w
(A)  W can be recursively enumerable and Z is recur-
∈ L(R)?
sive.
II. Given a context-free grammar G, is L(G) = Ø ?
(B)  W can be recursive and Z is recursively enumer-
III. Given a context-free grammar G, is L(G) = ∑*
able.
for some alphabet ∑ ?
(C)  W is not recursively enumerable and Z is recur-
IV. Given a Turing machine M and a string w, is w ∈
sive.
L(M)?
(D)  W is not recursively enumerable and Z is not re-
(A) I and IV only (B) II and III only
cursive.
(C) II, III and IV only (D) III and IV only
13. Consider the following types of languages: L1:
Regular, L2: Context - free, L3: Recursive, L4: 17. The set of all recursively enumerable languages is:
Recursively enumerable. Which of the following is /  [2018]
are TRUE? [2016] (A) Closed under complementation.
I. L3 ∪ L4 is recursively enumerable (B) Closed under intersection.
(C) A subset of the set of all recursive languages.
II. L 2 ∪ L3 is recursive (D) An uncountable set.
Chapter 3  •  Recursively Enumerable Sets and Turing Machines, Decidability  |  5.49

18. Consider the following problems. L(G) denotes the (IV) Given and NFA N, whether there is a determin-
language generated by a grammar G. L(M) denotes istic PDA P such that N and P accept the same
the language accepted by a machine M. language.
(I) For an unrestricted grammar G and a string w, Which one of the following statements is correct?
whether w ∈ L(G)  [2018]
(II) Given a Turing machine M, whether L(M) is reg- (A) Only I and II are undecidable
ular (B) Only III is undecidable
(III) Given two grammars G1 and G2, whether L(G1) (C) Only II and IV are undecidable
= L(G2) (D) Only I, II and III are undecidable

Answer Keys
Exercises
Practice Problems 1
1. D 2. C 3. B 4. B 5. D 6. D 7. A 8. D 9. D 10. D
11. C 12. A 13. D 14. A 15. C

Practice Problems 2
1. B 2. D 3. B 4. B 5. A 6. B 7. C 8. B 9. D 10. B
11. C 12. B 13. B 14. B 15. A

Previous Years’ Questions


1. D 2. D 3. D 4. C 5. B 6. C 7. C 8. D 9.  B 10. D
11. D 12. C 13. D 14. C 15. A 16. D 17. B 18. D

You might also like