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

Module 5

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

Module 5

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

VARIANTS OF TURING MACHINES

• Turing machine we have introduced has a single tape δ (q, a) is


either a single triple (p, Y, D), where D = R or L, or is not defined.
• Multi-tape TM

• Non-deterministic TM
Single Tape Multi-track Turing Machine
Multi-tape TM

• A TM with more than one tape


• A multi-tape TM has a finite set Q of states, an initial state q0, a
subset F of Q called the set of final states, a set P of tape
symbols, a new symbol B not in P called the blank symbol.
• There are k tapes, each divided into cells. The first tape holds
the input string w.
• Initially all the other tapes hold the blank symbol.(B)
• Initially the head of the first tape (input tape) is at the left
end of the input w.
• All the other heads can be placed at any cell initially.

δ is a partial function from Q x Гk into Q x Гk x {L, R, S}k.


In a typical move:

TM M enters a new state.

1. On each tape a new symbol is written in the cell under the head.

2. Each tape head moves to the left or right or remains stationary.


The heads move independently: some move to the left, some to
the right and the remaining heads do not move
• The initial ID has the initial state q0, the input string w in the first
tape (input tape), empty strings of B's in the remaining k - 1 tapes.
• An accepting ID has a final state, some strings in each of the k tapes.
• Multi-tape TM is more powerful than single tape TM but the
language accepted by Multi-tape TM is recursively enumerable
language.
• That means language accepted by Multi-tape TM is also accepted by
basic or standard TM.
• Multi-tape TM and standard TM are equivalent.
Theorem

Every language accepted by a multi-tape TM is acceptable by


some single-tape TM (that is, the standard TM).
OR
Show that language accepted by Multi-tape TM is recursively
enumerable language.
Proof
• Suppose a language L is accepted by a k-tape (Multi
tape) TM M. We simulate M with a single-tape TM with
2k tracks.
• Let us consider the implementation description by
considering k = 2
• We will prove this theorem by simulating the working of
2-tape TM with the working of single tape 4-track TM.
• The second, fourth, ..., (2k)th tracks hold the contents
of the k-tapes.
• The first, third, ... , (2k - 1)th tracks hold a head marker
(a symbol say X) to indicate the position of the
respective tape head.
Let us consider the content of 2-Tape Turing Machine:

δ (q, a2, b5) = (qnext , 0, 1, L, R)


δ (q, a2, b5) = (qnext , 0, 1, L, R)
Equivalent single tape 4-track TM corresponding to 2-tape TM
(Multi tape TM)
• Initially the contents of tapes 1 and 2 of Multi tape TM
M are stored in the second and fourth tracks of single
tape 4-track tape M1.

• The R/w head markers (X) of the first and third tracks
are at the cells containing the first symbol.

δ (q, a2, b5)


• To simulate a move of Multi-tape TM M, the single tape 2k-track
TM M1 has to visit the two head markers and store the scanned
symbols in its finite control.
• Keeping track of the head markers visited and those to be visited is
achieved by keeping a count and storing it in the finite control of
single tape TM.
• It takes extra codes to perform these operations.

• The finite control of single tape 2k-track M1 has also the


information about the states of multi-tape TM M and its moves.

δ (q, a2, b5)


• After visiting both head markers, single tape 2k-track TM M1
knows the tape symbols being scanned by the two heads of 2-
tape TM M.

• Now M1 revisits each of the head markers to perform the


following operations:
• It changes the tape symbol in the corresponding track of
single tape 2–track TM M1 based on the information
regarding the move of 2-tape TM M corresponding to the
state (of M) and the tape symbol in the corresponding tape
M.
• It moves the head markers to the left or right.
• M1 changes the state of M in its control.
This is the simulation of a single move of M.
• At the end of this, M1 is ready to implement its next move
based on the revised positions of its head markers and the
changed state available in its control.

• Single tape 2-track TM M1 accepts a string w if the new state


of 2 tape TM M, as recorded in its control at the end of the
processing of w’ is a final state of M.
NON-DETERMINISTIC TURING MACHINES
For every NDTM there exists a DTM such that L(NDTM) = L (DTM)
THE MODEL OF LINEAR BOUNDED AUTOMATON (LBA)

• The set of context-sensitive languages is accepted by the


model
• The infinite storage is restricted in size but not in accessibility
to the storage in comparison with the Turing machine model.
• A linear function is used to restrict (to bound) the length of
the tape.
• A linear bounded automaton is a non-deterministic Turing
machine which has a single tape whose length is not infinite
but bounded by a linear function of the length of the input
string
• There are two tapes: one is called the input tape, and the
other, working tape.
• On the input tape the head never prints and never moves to
the left.
• On the working tape the head can modify the contents in any
way, without any restriction.
• The set of strings accepted by nondeterministic LBA is the set
of strings generated by the context-sensitive grammars,
excluding the null strings.
• The context sensitive language is accepted by LBA
• Language accepted by LBA is a context sensitive language.
LBA to accept the language L = { an bn cn | n ≥ 1}
Decidability
Procedure:
 A procedure for solving a problem is a finite sequence of
instructions which can be mechanically carried out given any
input.
ALGORITHM
 Procedure that terminates after a finite number of steps for
any input.
 The formal definition of algorithm emerged after the works of Alan
Turing and Alanzo Church in 1936.
 Any algorithmic procedure that can be carried out by a human or a
computer, can also be carried out by a Turing machine.
 Thus the Turing machine arose as an ideal theoretical model for an
algorithm
Recursive Language
• A language L is said to be recursive language if we have an
algorithm to determine whether a given element belongs to L or
not.
• If there exists a Total TM that accepts every string of the
language and every string is rejected if it is not belonging to that
language.
A Recursively Enumerable Language
• RE language L for which we have a procedure to determine
whether a given element belongs to L or not.
• A language is RE if there exists a TM that accepts every string
belonging to that the language. And if the string does not belong
to that language then it can cause a TM to reject the string or to
enter an infinite loop .

It is clear that a recursive language is recursively enumerable


DECIDABILITY
 TM halts when it reaches a final state after reading the entire
input.
 Turing machine M halts when M reaches a state q and a
current input 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. (it may enter into infinite loop)
• 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.
• If a language is recursive then it is called decidable
language.( Accepted by Total TTM)
• If the language is not recursive then it is called un-
decidable language. ( Not Accepted by Total TTM)
• If a language is accepted by TM then it is semi-
decidable language.
• The class of decidable problems are called as
solvable problems and the class of un-decidable
problems are called un-solvable problems.
Total TM Vs TM

• It is a TM, which is designed in such a way that ; if


valid input is given it always accept it and for invalid
input it reject it.
• TM is designed in such a way that; it always accept the
valid input. The input is invalid, then TM may reject
the input or it may enter into loop for ever.
Definition of an Algorithm

The algorithm is defined as a collection of un-ambiguous

Instructions occurring in some specific sequence and such

an algorithm should produce output for given set of input

in finite amount of time


Notion of Algorithm
Properties of Algorithm

• Non-ambiguity: each step in algorithm should be non-


ambiguous. Instruction should be clear and precise.
Instruction should not denote any conflicting meaning.
• Range of Input: Input range should be specified. If not
algorithm can go in an infinite state.
• Multiplicity: Same algorithm can be represented in
several different ways.

Sequential searching , binary search etc..


• Speed: Algorithm should be efficient and should
produce the output with fast speed.
• Finiteness: Algorithm should be finite. After certain
number of steps it should terminate.
DECIDABLE LANGUAGES

Decidability of regular languages:


 Problem of testing whether a deterministic finite
automaton accepts a given input string w is decidable?

Decidability of context free languages:


 The context-free grammar G accepts the input string w
is decidable

The context-sensitive grammar G accepts the input string

w is decidable
UNDECIDABLE LANGUAGES

Languages that are not recursively enumerable

TM will not halt on inputs that they do not accept.

There is no general algorithm to solve every instance of


the problem ie: un-decidable
• Are there languages that are not decidable by any Turing
machine (TM)? ---------- YES

i.e: Are there problems that cannot be solved by any


algorithm?
HALTING PROBLEM OF TURING MACHINE

• Reduction technique is used to prove the un-


decidability of halting problem of Turing machine
• Problem A is reducible to problem B if a solution to
problem B can be used to solve problem A.
• If A is reducible to B and B is decidable then A is
decidable.

• If A is reducible to B and A is un-decidable. then B is


un-decidable.

The Halting Problem is Un-decidable


THE POST CORRESPONDENCE PROBLEM (PCP)
• The Post Correspondence Problem (PCP) was first
introduced by Emil Post in 1946.
• Later, the problem was found to have many applications
in the theory of formal languages.
• The problem over an alphabet ∑ belongs to a class of
yes/no problems and is stated as follows:
• Consider the two lists of non-empty strings over an alphabet
∑ = { 0, 1}
• x = ( x1, x2, x3, x4,……………………. xn)
• y = ( y1, y2, y3, y4,……………………. yn)
• The PCP is to determine whether or not there exist
i1,i2……………im where 1 ≤ ij ≤ n such that
xi1 xi2………………… xim = yi1 yi2………………… yim
• The indices ij need not be distinct and m may be greater than
n. Also, if there exists a solution to PCP, there exist infinitely
many solutions.
Does the PCP with two lists x = (b, bab3, ba) and y = (b3, ba, a)
have a solution?

• We have to determine whether or not there


exists a sequence of substrings of x such that the
string formed by this sequence and the string
formed by the sequence of corresponding
substrings of y are identical.
x = (b, bab3, ba) and y = (b3, ba, a)
The required sequence is given by:
i1 = 2, i2 = 1, i3 = 1, i4 = 3, ie: (2, 1, 1, 3) and m = 4

bab3bbba = bab3b3a

Thus the PCP has a solution.


• If the first substring used in PCP is always xl and y1 then
the PCP is known as the Modified Post Correspondence
Problem
• If language L is a recursive language over ∑ then
show that L’ is also recursive.
• If L and L’ are both recursively enumerable then
show that L and L’ are recursive.
• Show that the union of two recursively enumerable
languages is recursively enumerable
• Show that the union of two recursive languages is
recursive.
If language L is a recursive language over ∑ then show that L’ is
also recursive
• If L is recursive then there exist a TTM with two outputs Yes
(Accept) or No(Reject). Thus the machine halts and T(M) = L
Let us construct a new machine M1 such that L’ = T(M1)
with the following steps

1. Accepting states of M are made non-accepting states of


M1 and there is no transition from that state in M1. That

means we have created a state in M1 that will Halt


without accepting.
2. Now create a new accepting state for M1 say ‘r’ and
there is no transition from r.
3. In machine M, for each of the transition with combination
of non-accepting state and input tape symbol, make the
same transition having the combination of accepting
state and input tape symbol, for M1

• Since M is guaranteed to halt M1 is also guaranteed to

Halt. In fact M1 accepts exactly those strings that M does

not accept. Thus we can say that M1 accepts L’


COMPLEXITY

We can measure the performance of an algorithm by computing two


factors:
• Amount of time required by an algorithm to execute
• Amount of storage required by an algorithm.
• Computing time complexity we come to know whether the algorithm
is slow or fast
• By computing space complexity we can analyze whether an
algorithm requires more or less space.
• Asymptotic notations such as Ω, Ѳ and O is the shorthand way to
represent the time complexity
Big Oh Notation

• A method of representing the upper bound of algorithm’s


running time.
• Using Big Oh notation we can give longest amount of time
taken by algorithm to complete.
• Let f(n) and g(n) be two non-negative functions
• Let n0 and constant c are two integers such that n0 denotes
some value of input and n > n0.
• Similarly c is some constant such that c > 0 we can write
f(n) ≤ c * g(n)
Consider the function f(n) = 2n +2 and g(n) = n2

Find some constant c, so that f(n) <= c* g(n)


Find c when n = n0 = 1
f(n) = 2n +2 and g(n) = n2
f(n) = 4 and g(n) = 1 f(n) > g(n)

n= 2
f(n) = 6 and g(n) = 4 f(n) > g(n)
n= 3
f(n) = 8 and g(n) = 9 f(n) < g(n)

Hence we can conclude that for n > 2, we obtain f(n) < g(n)
Thus the upper bound of existing time is obtained by Big Oh
notation.
GROWTH RATE OF FUNCTIONS

• When we have two algorithms for the same problem,


we may require a comparison between the running
time of these two algorithms.
• Measuring the performance of an algorithm in
relation with the input size ‘n’ is called order of
growth.
The classes P and NP problems
Problems can be classified under two groups
1. P- problem: Problem can be solved in polynomial
time.
Searching of an element from the list O(logn)
Sorting of elements of O(logn)

2. NP-problem: Problem can be solved in non-


deterministic polynomial time.
Knapsack problem O(2n/2) and travelling
salesperson problem (O(n)).
• A Turing machine M is said to be of time complexity
T(n) if the following holds:
• Given an input w of length n, M halts after making at

most T(n) moves.


Construct the time complexity T(n) for the Turing machine
M
to accept the language L = {an bn | n ≥ 1}
• Consists of going through the input string (an bn) forward
and backward and replacing the leftmost a by X and the
leftmost b by Y. So we require at most 2n moves to match
a 0 with a 1.
• Repetition of the above step requires n number of times.

• Hence the number of moves for accepting an bn is at most


(2n) n
• For strings not of the form an bn , TM halts with less than
2n2 steps.
Hence T(n) = O(n2).
NP Problem
Quantum Computation

• We know that a bit (a 0 or a 1) is the fundamental


concept of classical computation and information.
• Classical computer is built from an electronic circuit
containing wires and logical gates
• Quantum bits

• Quantum Circuits
Quantum bit (Qubit)

• A classical computer has a memory made up of bits


(0 or 1)
• Quantum computer maintains a sequence of qubits

• Qubit can be mathematically described as:


• The classical computer bits has two states 0 and 1.
• The two possible states for a qubit are the states
|0 > and |1 >
• Qubit is represented using | >
• Qubit can be in infinite number of states other than | 0 >
and | 1 >
• It can be in state

Where α and β are complex numbers such that


|α|2 + |β|2 = 1
Quantum state

It is not possible to obtain the quantum states by observation,


whereas in classical computer bit 0 and 1 can be observed.
Multiple qubits can be defined.
Example: Two qubit system has 4 basis states
|0 0>
|0 1>
|10 >
|11 >
Quantum states can be:
Qubit for Logical Not gate

• It is possible to define logical gates using qubit

• The classical NOT gate changes the 0 to 1 and 1 to 0

• Incase of qubit NOT gate

is changed to
• The action of qubit NOT gate can be represented using
matrix as:

Thus the quantum computer is a system built from


quantum circuits, containing wires and elementary
quantum gates to carry out manipulation of quantum
information.
CHURCH-TURING THESIS

Any algorithm that can be performed on any computing


machine can be performed on a Turing machine as well.

Any algorithmic process can be simulated efficiently


by a Turing machine
• But a challenge to the strong Church-Turing thesis arose
from analog computation.
• Certain types of analog computers solved some problems

efficiently whereas these problems had no efficient

solution on a Turing machine. But when the presence of


noise was taken into account, the power of the analog
computers disappeared.
• In mid-1970s. Robert Solovay and Volker Strassen gave
a randomized algorithm for testing the primality of a
number. (A deterministic polynomial algorithm was
given by Manindra Agrawal, Neeraj Kayal and Nitein
Saxena of IIT Kanpur in 2003) This led to the
modification of the Church thesis.
Strong Church-Turing Thesis

Any algorithmic process can be simulated efficiently using a


non-deterministic Turing machine.

You might also like