0% found this document useful (0 votes)
106 views22 pages

FLAT-Unit 5

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

FLAT-Unit 5

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

Formal Language and Automata Theory

Unit 5
2 marks:

1. Lu is recursively enumerable but not recursive. Lu is the set of binary strings that
consist of encoded pairs (M, w) such that M is an encoding of a Turing machine
and w is an encoding of a binary input string accepted by that Turing machine.

2. CAN CHURCH-TURING THESIS BE PROVED?

The Church-Turing thesis (formerly commonly known simply as Church's


thesis) says that any real-world computation can be translated into an equivalent
computation involving a Turing machine.The Church-Turing thesis cannot be
proved because it relates a formal concept (Turing machines) to a vaguely defined
informal one. An algorithm is defined as a sequence of instructions that can be
unambiguously carried out by a human to obtain some kind of a result. However,
this thesis can be supported in various ways.

1. No one has yet found a natural example of an algorithm that could not
be simulated by a Turing machine.
2. Also, the fact that all reasonable extensions to Turing machines do
not increase their power is a justification of the Church-Turing thesis.

Using the Church-Turing thesis, if one can show that a problem cannot be
solved on a Turing machine, then it is reasonable to conclude that it cannot be
solved by any computer or by any human.

3. TURING RECOGNIZABLE LANGUAGE:

A language which is Turing Recognizable if there is a Machine that will halt and
accept only the strings in that language and not in that language, then that TM
either rejects, or does not halt at all.
A = {hM, wi | M is a TM and w ∈ L(M)} is recognizable.

TURING DECIDABLE LANGUAGE:

A language is said to be Decidable if there is a Machine that will accept strings in


the language and reject strings not in the language.

A = {hM, wi | M is a DFA and w ∈ L(M)} is decidable.

4. An undecidable problem is a decision problem for which it is proved to be impossible


to construct an algorithm that always leads to a correct yes-or-no answer. The halting
problem is an example: it can be proven that there is no algorithm that correctly
determines whether arbitrary programs eventually halt when run

5. P-Class: Problem solvable in polynomial time. i.e. these problems can be solved in time
O(n k) in the worst-case, where k is constant.

6. NP-Class: Problem verifiable in polynomial time. NP class is a decision problem to


check the correctness of the claimed answer. Every problem in the given class can be
solved in exponential time using exhaustive search.

7. Universal Turing machine (UTM) is a Turing machine that can simulate an arbitrary Turing
machine on arbitrary input. The universal machine essentially achieves this by reading both the
description of the machine to be simulated as well as the input to that machine from its own
tape.

8. RECURSIVE LANGUAGE:

It is a Turing decidable language. A language is recursive if there exists a Turing


machine M, which accepts every string of the language and rejects every string
that is not in the language.

If there is some Turing machine M that halts on every input W ε Σ, then L=L(M).
Eg: L={anbncn |n>=1}, then it moves to the final state when W=anbncn ,otherwise it
moves to non-final state.

9. A recursively enumerable language is a formal language for which there exists


a Turing machine that will halt and accept when presented with any string in the
language as input but may either halt and reject or loop forever when presented
with a string not in the language.

10. Cook's theorem, states that the Boolean satisfiability problem is NP-complete.
That is, it is in NP, and any problem in NP can be reduced in polynomial time by
a deterministic Turing machine to the Boolean satisfiability problem.

PART B
1.

Explain the following:


(i) Recursively language.
(ii) Recursively enumerable language.
2. Implement a Turing Machine for L = { 0n1n0n| n ≥ 1 } also derive the computation
sequence 001100
3. Universal Turing Machine

The Universal Turing Machine

Universal Turing machine, which we’ll call U. U is not truly “universal” in the
sense that it can compute “everything”. U is, however, universal in the sense that,
given an arbitrary Turing machine M and an input w, U will simulate the operation
of M on w.

We can state U’s specification as follows: On input <M, w>, U must:

● Halt iff M halts on w.

● If M is a deciding or a semi deciding machine, then:

○ If M accepts, accept.

○ If M rejects, reject.

● If M computes a function, then U(<M, w>) must equal M(w).

U will use three tapes to simulate the execution of M on w:

● Tape 1 will correspond to M’s tape.

● Tape 2 will contain <M>, the “program” that U is running.

● Tape 3 will contain the encoding of the state that M is in at any point during
the simulation. Think of tape 3 as holding the program counter.

When U begins, it will have <M, w> on tape 1. (Like all multitape machines, it
starts with its input on tape 1 and all other tapes blank.)

In each step (transitions), TM reads symbols scanned by all heads, depending on those
and current state, each head writes, moves R or L, and control-unit enters into a new state.
Actions of heads are independent of each other.
The tapes of the universal Turing machine U
U begins simulating M with the read/write heads of its three tapes as shown above.
More generally, it will start each step of its simulation with the read/write heads
placed as follows:
● Tape 1’s read/write head will be over the a that is the first character of the
encoding of the current character on M’s tape.
● Tape 2’s read/write head will be at the beginning of <M>.
● Tape 3’s read/write head will be over the q of the program
counter. Following initialization as described above, U operates as
follows:
1. Until M would halt do:
Scan tape 2 for a quintuple that matches the current state, input pair.
Perform the associated action, by changing tapes 1 and 3. If necessary, extend the
simulated tape that is encoded on tape 1. If no matching quintuple is found, halt.
2. Report the same result M would report:
● ·If M is viewed as a deciding or semideciding machine for some language L: if
the simulated state of M is y, then accept. If the simulated state is n, then reject.
● If M isviewed as a machine that computes a function: reformat the tape so that
the value of tape 1 is all that is left.
How long does it take U to simulate the computation of M? If M would halt in k
steps, then U must go through its loop k times. Each time through the loop, it must
scan <M> to find out what to do. So, U takes O(|M|×k) steps.
Now we know that if we wanted to build real Turing machines, we could build one
physical machine and feed it descriptions of any other Turing machines that we
wanted to run. So, this is yet another way in which the Turing machine is a good
general model of computation.

4.(a).Post Correspondence Problem:


Post Correspondence Problem is a popular undecidable problem that was
introduced by Emil Leon Post in 1946. It is simpler than Halting Problem. In this
problem we have N number of Dominos (tiles). The aim is to arrange tiles in such
order that string made by Numerators is same as string made by Denominators. In
simple words, let’s assume we have two lists both containing N words, aim is to
find out concatenation of these words in some sequence such that both lists yield
same result. Let’s try understanding this by taking two lists A and B

A=[aa, bb, abb] and B=[aab, ba, b]

Now for sequence 1, 2, 1, 3 first list will yield aabbaaabb and second list will yield
same string aabbaaabb. So, the solution to this PCP becomes 1, 2, 1, 3. Post
Correspondence Problems can be represented in two ways:

Domino’s Form:
Table Form:

Eg:
Explanation –

● 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. Let’s 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


● As you can see, strings are same:

4 (b) Universal language.

The Universal Language Lu


● We have seen one language, the diagonalization language, that is not accepted by any
Turing machine. This proves the diagonalization language is not recursively
enumerable.
● We shall now define a language Lu, the universal language, that can be accepted by a
Turing machine but is still undecidable. Lu is recursively enumerable but not
recursive.
● Lu is the set of binary strings that consist of encoded pairs (M, w) such that M is an
encoding of a Turing machine and w is an encoding of a binary input string accepted
by that Turing machine.
● Formally, Lu = { (M, w) | M is an encoding of a Turing machine and w is an encoding of
a binary string accepted by M }.
Lu is Recursively Enumerable
● To show that Lu is recursively enumerable, we shall construct a Turing machine U,
called the universal Turing machine, to recognize Lu.
● It is convenient to think of U as a multitape TM in which:
1. The first tape holds the input with the encodings of M and w. We use the
encodings of Turing machines and binary strings we developed in Lecture
14.
2. A second tape is used to simulate M's input tape. We initialize the second tape
with the encoded form of w. We then move the head on the second tape to the
first simulated cell.
3. A third tape is used to keep track of M's state. We initialize the third tape with
the start state of M.
4. A fourth tape is used as a scratch tape.
● To simulate a move of M, U searches tape 1 for a transition on the current state of M
(stored on tape 3) and the current tape symbol of M (stored on tape 2). Then,
1. U changes the contents of tape 3 to record the new state.
2. U changes the tape symbol on tape 2.
3. U moves M's tape head left or right on tape 2 as specified by the transition.
● U simulates the behavior of M on the input string w by repeated making moves in this
manner. If M enters its final state signaling that M accepts w, then U accepts the
coded pair (M, w) and halts.
● Thus, L(U) = Lu.
● As we can see, U has the elements of a modern stored program digital computer!

Lu is not Recursive
● Suppose Lu were recursive. Then there would exist a TM M that accepts the
complement of Lu.
● But now we can transform M into a TM M' that accepts Ld as follows:
○ M' transforms its input string w into a pair (w, w).
○ M' simulates M on (w, w) assuming the first w is an encoding of a TM Mi and the
second w is an encoding of a binary string wi. Since M accepts the complement
of Lu, M will accept (w, w) if and only if Mi does not accept wi.
● Thus, M' accepts w if and only if w is in Ld. But we have previously shown there does
not exist a TM that recognizes Ld.
● We conclude Lu is not recursive.
5. (i)Undecidability of PCP:
The most common proof for the undecidability of PCP describes an instance of PCP
that can simulate the computation of an arbitrary Turing Machine on a particular
input.
the full state of the machine consists of three parts:
● The current contents of the tape.
● The current state of the finite state machine which operates the tape head.
● The current position of the tape head on the tape.
5. (ii) RICE THEOREM:
6.(i).P-Class

The class P consists of those problems that are solvable in polynomial time, i.e.
these problems can be solved in time O(n) in worst-case, where k is constant.These
problems are called tractable, while others are called intractable or
superpolynomial.

Formally, an algorithm is polynomial time algorithm, if there exists a polynomial


p(n) such that the algorithm can solve any instance of size n in a time O(p(n)).
The P-class is a subset of NP-

class. NP-Class

The class NP consists of those problems that are verifiable in polynomial time. NP
is the class of decision problems for which it is easy to check the correctness of a
claimed answer, with the aid of a little extra information. Hence, we aren't asking
for a way to find a solution, but only to verify that an alleged solution really is
correct.

Every problem in this class can be solved in exponential time using exhaustive search.

6 (ii) ) Discuss P and NP classes in Theory of Computation.


P-Class
● The class P consists of those problems that are solvable in polynomial time, i.e.
these problems can be solved in time O(n k) in the worst-case, where k is
constant.
● These types of problems are called tractable and others are called intractable
or super polynomial.
● Generally, an algorithm is a polynomial time algorithm, if there exists a
polynomial p(n) such that the algorithm can solve any instance of size n in a
time O(p(n)).
● Problems requiring Ω(n 50) time to solve are essentially intractable for large n.
Most known polynomial time algorithms run in time O(n^k) for a fairly low
value of k.
● The advantage in the class of polynomial-time algorithms is that all reasonable
deterministic single processor models of computation can be simulated on
each other with at most a polynomial slow-d.

NP-Class

● The class NP consists of problems that are verifiable in polynomial time. NP is a


class of decision problems for which it is easy to check the correctness of a
given answer, with the aid of a little extra information. Hence, we are not asking
for a way to find a solution, but only to verify that a solution really is correct.
● Every problem in the given class can be solved in exponential time
using exhaustive search.

Example

Consider an example to check if a problem is in P class or NP class

Step 1 − If a problem is in class P, it is nothing but we can find a solution to that type of
problem in polynomial time.

Step 2 − If a problem is in class NP, it is nothing but that we can verify a possible solution in
polynomial time.
Step 3 − Consider another way, NP means that a problem is NondeterministicallyPolynomial.
Specifically, that means that if you could build a machine that had the ability to try all the
possible solutions of your problem at once, it could finish in polynomial time.

We know this to be true because we know that we can verify a possible solution in polynomial
time, and what that machine is basically doing is trying to verify (test) all of the potential
answers to the problem at the same time.

Step 4 − So, if you can solve a problem in polynomial time, you can certainly verify that your
answer is correct in polynomial time, can't you? Sure, if you can prove that your algorithm is
correct and that it can find an answer in polynomial time, which it must to be in P.

7. (i) Write the classes and definition of P and NP


Problems. P Class:

The P in the P class stands for Polynomial Time. It is the collection of decision
problems(problems with a “yes” or “no” answer) that can be solved by a
deterministic machine in polynomial time.

Features:
1. The solution to P problems is easy to find.
2. P is often a class of computational problems that are solvable and tractable.
Tractable means that the problems can be solved in theory as well as in
practice. But the problems that can be solved in theory but not in practice
are known as intractable.
This class contains many natural problems like:
1. Calculating the greatest common divisor.
2. Finding a maximum matching.
3. Decision versions of linear programming.

NP Class:

The NP in NP class stands for Non-deterministic Polynomial Time. It is the collection


of decision problems that can be solved by a non-deterministic machine in
polynomial time.
Features:
1. The solutions of the NP class are hard to find since they are being solved
by a non- deterministic machine but the solutions are easy to verify.
2. Problems of NP can be verified by a Turing machine in
polynomial time. Example:
Let us consider an example to better understand the NP class. Suppose there is a
company having a total of 1000 employees having unique employee IDs. Assume
that there are 200 rooms available for them. A selection of 200 employees must be
paired together, but the CEO of the company has the data of some employees who
can’t work in the same room due to some personal reasons.
This is an example of an NP problem. Since it is easy to check if the given choice of
200 employees proposed by a coworker is satisfactory or not i.e. no pair taken from
the coworker list appears on the list given by the CEO. But generating such a list
from scratch seems to be so hard as to be completely impractical.
It indicates that if someone can provide us with the solution to the problem, we
can find the correct and incorrect pair in polynomial time. Thus for the NP class
problem, the answer is possible, which can be calculated in polynomial time.
This class contains many problems that one would like to be able to solve effectively:
1. Boolean Satisfiability Problem (SAT).
2. Hamiltonian Path Problem.
3. Graph coloring.

(ii) Cook’s Theorem:


PART B & C

1. Construct a Turing machine which multiplies two unary numbers.


n n
2. Construct a Turing machine for Language L=a b ,where n>0
3. Construct a Turing machine that recognizes the language L={anbn, n>1}. Show an ID for the
string ‘aabb’ with tape symbols.
4. Explain conversion of regular Expression to TM with example.
5. Explain the various types of Turing machine.
6. Explain Universal turing machine
7. a)Design a multi head Turing Machine for checking whether a binary string is a
palindrome or not. Show the ID for 1001. [L3,6M]
b) Write about Universal TM.
8. Explain in detail about variations of the TM?
9. Construct a Turing machine that recognizes the language anbncn.
10. a) Define PCP. Verify whether the following lists have a PCP solution.
11. , , , , , .
b) Describe linear bounded automaton.

You might also like