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

V sem_ToC_Module 5

Uploaded by

k chandana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

V sem_ToC_Module 5

Uploaded by

k chandana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Module-5

Objectives: Decidability: Definition of an algorithm, decidability, decidable languages,


Undecidable languages, halting problem of TM, Post correspondence problem. Complexity: Growth
rate of functions, the classes of P and NP, Quantum Computation: quantum computers, Church-
Turing thesis. Applications: G.1 Defining syntax of programming language, Appendix J: Security

References:
1. K L P Mishra, N Chandrasekaran , 3rd Edition, Theory of Computer Science, PhI, 2012.

Chapter-10

Variants of Turing Machines (TM):


Turing machine we have discussed so far has a single tape, δ (q, a) is either a single triple (p, Y, D),
where
D = R or L, or is not defined. If we modify the structure of Turing machine , we get variants of TM such
as:
 Multi-tape TM
 Non-deterministic TM

Single tape TM
R/W head is pointing to the input symbols, c in track 1, a in track 2 and b in track 3 of tape
consisting of 3-track(multi-track) tape.

Let us assume that after reading these three symbols machine moves right by replacing a by X and b
by Y and c by Z by entering into any arbitrary state say, qnext.

The transition function is as follows:


Multi-Tape TM:
A Turing machine M 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 transition function from Q x Гk into Q
x Гk x {L, R, S}k. where k is the number of 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. On each tape a new symbol is written in the cell under the head.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.

Example: δ(q, a, b, c) = (p, X, Y, Z, L, R, R)


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 M1 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 (M) with the working of single tape 4-
track TM (M1). Assume that the second, fourth, ..., (2k)th tracks hold the contents of the k-tapes.
The first, third, ... , (2k - 1)th tracks hold a R/w head marker (a symbol say X) to indicate the
position of the respective tape head.

Let us consider the single move of above multi tape TM:


δ (q, a2, b5) = (qnext , 0, 1, L, R)
The R/w head markers (X) of the first and third tracks are at the cells containing the first symbol.
To simulate the above move of Multi-tape TM M in single tape TM M1, the single tape TM M1 has
to visit the two R/w head markers and store the scanned symbols in its finite control.
The finite control of single tape TM M1 has also the information about the states of multi-tape TM
M and its moves.

δ (q, a2, b5)


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 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

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


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 TM M1 accepts a string w only
when it reaches a state that is recorded as a final state of M in its control at the end of the processing
of w. Hence the proof.
Non-Deterministic TM:
The non-deterministic Turing machine is a kind of TM in which the set of rules denote more than
one specific action reading particular input in current specific state.
A Non-deterministic TM can be formally defined as M: which is a 7-tuple, namely (Q, Σ ,Г, δ, q0.
B, F) where
• Q is a finite nonempty set of states.
• Г is a finite nonempty set of tape symbols,
• B is the blank symbol.
• Σ is a nonempty set of input symbols and is a subset of Г and B ≠ Σ
• δ is the transition function mapping (q, x) onto (q‟, y, D) where D denotes the direction of
movement of R/W head: D = L or R according as the movement is to the left or right.
Q X Г → power set of Q x Г x { L/R}
• q0 € Q is the initial state, and
• F is the subset of Q is the set of final states.

It is clear from the definition of δ that for each state q and tape symbol X, δ( q, Г) is a set of triples
THE MODEL OF LINEAR BOUNDED AUTOMATON (LBA)
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. A linear
function is used to restrict (to bound) the length of the tape. The set of context-sensitive languages is
accepted by this model.
LBA is formally defined as M: which is a 9-tuple, namely (Q, Σ ,Г, δ, q0. B, , $, F) where
• Q is a finite nonempty set of states.
• Г is a finite nonempty set of tape symbols,
• B is the blank symbol.
• Σ is a nonempty set of input symbols with two special symbols ,$ and is a subset of Г and B ≠ Σ
• δ is the transition function mapping (q, x) onto (q‟, y, D) where D denotes the direction of
movement of R/W head: D = L or R according as the movement is to the left or right.
Q X Г → Q x Г x { L/R}
• q0 € Q is the initial state, and
F is the subset of Q is the set of final states
is the left end marker, which is entered in the leftmost cell of the input tape and prevents the R/W
head from getting off the left end of the tape.
$ is the right end marker, which is entered in the rightmost cell of the input tape and prevents the
R/W head from getting off the right end of the tape. Both the end markers should not appear on any
other cell within the input tape. R/W head should not print any other symbol over both the end
markers.

Linear Bounded Automata Model:

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. That is context sensitive language.
DECIDABILITY
Procedure:
A procedure for solving a problem is a finite sequence of instructions which can be mechanically
carried out for the 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. The Church-Turing thesis states that 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.
Define 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.
This definition is represented as follows:

After understanding the problem statement we have to create an algorithm carefully for the given
problem
Algorithm is then converted into some programming language and then given to some computing
device (Computer)
The computer then executes this algorithm which is actually submitted in the form of source
program.
During the process of execution with the help of algorithm and input set, the result is produced as an
output.
If the given input is invalid then it should raise appropriate error message; otherwise correct result
will produced as an output.

Explain the properties of an algorithm


• Non-ambiguity: Each step in algorithm should be non-ambiguous. That means 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. For example Searching
algorithm, we can use sequential searching method or binary search method.
• 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.

DECIDABILITY
The notion of a recursively enumerable language and a recursive language existed even before the
invention of computers. These languages are also defined using Turing machines as follows:
TM halts when it reaches a final state after reading the entire input string w
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. That leads to the property of decidability and un-
decidability of the language.

Recursively Enumerable Languages: (RE Languages)


A language L which is a subset of Σ* is a recursively enumerable language if there exists a TM M,
such that L = T(M). ( Halt or enter into infinite loop)
Recursively Languages:
A language L which is a subset of Σ* is a recursive language if there exists a TM M, that satisfies the
following two conditions.
i. If the string w is defined in the language, then the TM accepts the string w and Halts.
ii. If the string w is not defined in the language, then the TM eventually Halts without reaching an
accepting state.
Recursive language definition assures us that TM always Halts. It is clear that a recursive language
is subset of recursively enumerable language.
DECIDABLE LANGUAGES
A language L is said to be decidable language if the corresponding language L is recursive language.
That is a problem with two answers Yes/No is decidable if the corresponding language is recursive.
The class of decidable problems is called as solvable problems. Decidability of regular languages:
Problem of testing whether a deterministic finite automaton accepts a given input string w is
decidable?
Show that language accepted by a DFA is decidable.
Proof: By simulating the working of DFA B and input w in TM M Let ADFA = {(B, w) | B accepts
the input string w}
Let us construct a TM which takes the input as (B, w) represented by the five components of DFA
as: Q, Σ, δ, q0, F by strings of w € Σ*.
A Turing Machine M check the input (B, w) is a valid input, if not TM rejects (B, w) and Halts. If
the input (B, w) is a valid input, TM M writes the initial state q0 and the leftmost input symbol of w.
It updates the state using the transition function of DFA δ and then reads the next input symbol in w.
If the simulation ends in an accepting state for the input w, then M accepts (B, w) otherwise M
rejects (B, w). M accepts (B, w) if and only if w is accepted by DFA B.

Decidability of context free languages:


The context-free grammar G accepts the input string w is decidable Decidability of context sensitive
languages:
The context-sensitive grammar G accepts the input string w is decidable

UNDECIDABLE LANGUAGES
If the language L is not a recursive language, then such a language is called un-decidable language.
If there is any language L which is recursively enumerable then there exists a TM which semi-
decides it(either accept or reject or loops forever). Every TM has description of finite length. Hence
the number of TM and number of RE languages is count-ably infinite. ATM = {(M, w) | The TM M
accepts w} is un-decidable.

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. For
example, if A is the problem of finding some root of x4 - 3x2 + 2 = 0 and B is the problem of finding
some root of x2 - 2 = 0, then A is reducible to B. As x2 - 2 is a factor of x4 - 3x2 + 2. A root of x2 - 2
= 0 is also a root of x4 - 3x2 + 2.
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 Turing machine M halts on input w is un-decidable.
The output of TM can be:
Halt: The machine starting at this configuration will halt after a finite number of states.
No-Halt: The machine starting at this configuration never reaches a halt state, no matter how long it
runs. Based on these two observations: given any functional matrix, input data tape and initial
configuration, then it is possible to determine whether the process will ever halt? This is called
Halting problem. That means we are asking for a procedure which enable us to solve the halting
problem for every pair of machine input as: (Machine, Tape symbol). The answer is NO. That means
Halting problem is un-decidable or un-solvable

Prove that Halting Problem of TM is un-decidable


OR
HALTTM = {(M, w) | The Turing Machine M halts on input w} is un-decidable Let us assume that
Halting problem (HALTTM) is decidable

Let M1 be the TM which decides whether or not any computation by another TM M will ever halt
when a description of that TM M is given as M and tape symbol as w.
That means input to M1 will be (machine, tape) pair; (M, w)
Then for every input (M, w) to M1; if TM M accept input w, then M1 halts which is called Accept
halt.
Similarly if M does not accept input w then the machine M1 will halt which is called reject halt.

Now we construct one more TM M2 which takes an input M.


It first copies M and duplicates M on its tape and then this duplicated tape information are given as
input to machine M1. But machine M1 is a modified machine with modification that whenever M1
is supposed to reach an accept halt, M2 loops forever. The behavior of M2 is as shown below:
It loops if M halts for input w and halts if M does not halt for input w.

As M2 itself is one TM we will take M2 = M. that means we will replace M by M2 from the above
given machine.
Thus the machine M2 halts for input M2, if M2 does not halt for M2. This is a contradiction. That means
a machine M1 which can tell whether any other Turing machine will halt on particular input does not
exist. Hence halting problem is un-decidable.
THE POST CORRESPONDENCE PROBLEM
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.

1. Does the PCP with two lists x = (b, bab3, ba) and y = (b3, ba, a) have a solution?
Answer:
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
The corresponding strings are:

bab3bbba = bab3b3a i.e.: babbbbbba = babbbbbba Thus the PCP has a solution

2. Does the PCP with two lists x = (11, 100, 111) and y = (111, 001, 11) have a solution?

Solution:
The required sequence is given by:
i1 = 1, i2 = 2, i3 = 3, ie: (1, 2, 3) and m = 3
The corresponding strings are:
11100111 =11100111 ; Thus the PCP has a solution
3. Prove that PCP with two lists x = (01, 1, 1), y = (012 , 10, 11) has no solution
Solution:
For each substring xi € x and yi € y, we have |xi | < | yi | for all i. Hence the string generated by a
sequence of substrings of x is shorter than the string generated by the sequence of corresponding
substrings of y. Therefore, the PCP has no solution.

Note: If the first substring used in PCP is always xl and y1 then the PCP is known as the Modified Post
Correspondence Problem.
If L1 and L2 are recursive languages then Show that L1 U L2 is also recursive language.
OR
Show that the recursive languages are closed under union.

Proof:
Let L1 and L2 are recursive languages.
As L1 and L2 are recursive languages there exists a TM M1 that accepts L1 and M2 that accepts
L2. Now we have to simulate a TM M that accepts the language L such tat L = L1 U L2
Construction of TM M is as follows:

If the string w € L1 U L2, then it implies that either w € L1 or w € L2 or w belongs to both L1 and
L2. That means TM M1 accepts the string w; if w € L1 or TM M2 accepts the string w; if w € L2
Also M1 and M2 accept the string w if it belongs to both L1 and L2. Thus the simulated TM M
produces the output as Accept (yes).
Similarly if the string w does not belong to L1 U L2 then it implies that string w does not belongs L1
as well as L2, resulting in both the machine M1 and M2 produces the output as Reject. Thus the
simulated TM M also produces the output as Reject (No).
Thus the TM M accepts the language L = L1 U L2 is recursive. ( it produces only two outputs as Y
or N)

If L1 and L2 are recursively enumerable languages then Show that L1 U L2 is also recursively
enumerable language.
OR
Show that the recursively enumerable languages are closed under union.

Proof:
Let L1 and L2 are recursively enumerable languages.
As L1 and L2 are recursively enumerable languages there exists a TM M1 that accepts L1 and M2
that accepts L2. Now we have to simulate a TM M that accepts the language L such tat L = L1 U L2
Construction of TM M is as follows:
If the string w € L1 U L2, then it implies that either w € L1 or w € L2 or w belongs to both L1 and
L2. That means TM M1 accepts the string w; if w € L1 or TM M2 accepts the string w; if w € L2
Also M1 and M2 accept the string w if it belongs to both L1 and L2. Thus the simulated TM M
produces the output as Accept (yes).
Similarly if the string w does not belong to L1 U L2 then it implies that string w does not belongs L1
as well as L2, resulting in both the machine M1 and M2 produces the output as Reject. Thus the
simulated TM M also produces the output as Reject (No).

Sometimes the string w which does not belongs to L1, results in M1s output as entering into loop
forever or the string w which does not belongs to L2, results in M2s output as entering into loop
forever or the string w which does not belongs to both L1 and L2, results in M1‟s output as entering
into loop forever and M2‟s output as entering into loop forever. So the simulated TM M producing
output as loop forever.

Thus the TM M accepts the language L = L1 U L2 is recursively enumerable. (since it produces the
outputs as Y or N or loop forever)

Show that complement of a recursive language is also recursive language.


OR

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 „qf‟ and there is no transition from r.
3. If q is a non- accepting state of M and δ (q, x) is not defined, then add a transition from q to qf 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‟. So the complement of recursive
language L ie: L‟ is also recursive.
Chapter-12

COMPLEXITY
The efficiency of an algorithm can be decided by measuring the performance of an algorithm.
We can measure the performance of an algorithm by computing two factors:
i. Amount of time required by an algorithm to execute

ii. Amount of storage required by an algorithm.

Hence we define two terms- Time complexity and space complexity.


Time complexity: of an algorithm means the amount of time taken by algorithm to run. By
computing time complexity we come to know whether the algorithm is slow or fast
Space complexity of an algorithm means the amount of space (memory) taken by an algorithm. By
computing space complexity we can analyze whether an algorithm requires more or less space.
To select the best algorithm, we need to check efficiency of each algorithm. The efficiency can be
measured by computing time complexity of each algorithm. Asymptotic notations such as Ω,
Ѳ and O is the shorthand way to represent the time complexity. Using this notation we can give time
complexity as “fastest possible”, ”slowest possible or average time.

Big Oh Notation: The Big oh notation is denoted by O is 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.
Definition of Big Oh notation:
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)
then f(n) is Big Oh of g(n). ie: f(n) = O(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 times of these two algorithms.
Measuring the performance of an algorithm in relation with the input size ‘n’ is called order of
growth.

Let f,g:N->R+ (R+ being the set of all positive real numbers). We say that f(n)=O(g(n)) if there exist
positive integers C and N0 such that
F(n)<=Cg(n) for all n>=N0.
In this case we say f is of the order of g (or f is „big oh‟ of g)
Note: f(n)=O(g(n)0 is not an equation. It is expresses a relation between two functions f and g.

Let f(n)=4n3+5n2+7n+3. Prove that f(n)=O(n3).


Solution in order to prove that f(n)=O(n3), take C=5 and N0=10. Then
F(n)=4n3+5n2+7n+3<=5n3 for n>=10
When n=10, 5n +7n+3=573<103. For n>10, 5n2+7n+3<n3.
2

Then, f(n)=O(n3).

Growth rate of polynomial and exponential function

n f(n)=n2 g(n)=n2+3n+9 q(n)=2n


1 1 13 2
5 25 49 32
10 100 139 1024
50 2500 2659 (1.13)1015
100 10000 10309 (1.27)1030
1000 1000000 1003009 (1.07)10301

An exponential function is a function q:N->N defined by q(n)=an for some fixed a>1
When n increases, each of n, n2,2n increases. But a comparison of these functions for specific values
of n will indicate the vast difference between the growth rate of these functions.
Form the above table, the function q(n) grows at a very fast rate when compared to f(n) or g(n). in
particular the exponential function grows at a very fast rate when compared to any polynomial of
large degree. We prove a precise statement comparing the growth rate of polynomials and
exponential function.

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)).

P problem:
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.

A language L is in class P if there exists some polynomial T(n) such that L=T(M) for some
deterministic TM M of time complexity T(n).

Construct the time complexity T(n) for the Turing machine M to accept the language
L = {an bn | n ≥ 1}
• TM Consists of going through the input string (anbn) 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).

We can also define the complexity of algorithms. In the case of algorithms, T(n) denotes the running
time for solving a problem with an input of size n, using this algorithm.

NP Problem

A language L is in class NP if there is a nondeterministic TM M and a polynomial time complexity


T(n) such that L=T(M) and M executes at most T(n) moves for every input w of lengt n.

We have seen that a deterministic TM M simulating a nondeterministic TM M exists. If T(n) is the


complexity of M, then the complexity of the equivalent deterministic TM M1 is 2O(T(n)).
Quantum Computation: is the area of study that focuses on development of computer technology
based on the principle of quantum theory.

Quantum Computer:
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. Let us study quantum bits and quantum circuits which are analogous to bits and (classical)
circuits.
Quantum computer maintains a sequence of qubits. Qubit can be mathematically described as:

|ψ>= α|O> + β|O>

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 the notation | >. Qubit can be in infinite number of states
other than | 0 > and | 1 > . It can be in state
|ψ> = α|O> + β|O>

Where α and β are complex numbers such that


|α|2 + |β|2=1
The 0 and 1are called the computational basis states and |ψ> is called a superposition
|ψ>= α|O> + β|O>

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:
| ψ> = α00|00> + α01|01> + α10|10> + α11|11> with | α00|2 + | α01|2 + | α10|2 + | α11|2 =1

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
α|0> + β|1> is changed to
α|1> + β|0>
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.

In 1985, david Deutsch tried to build computing devices using quantum mechanics.
Computers are physical objects, and computations are physical processes. What computers can or
cannot compute is determined by the law of physics alone, and not by pure mathematics-David
Deutsch
But it is not known whether Deutsch‟s notion of universal quantum computer will efficiently
simulate any physical process. In 1994, Peter Shor proved that finding the prime factors of a
composite number and the discrete logarithm problem could be solved efficiently by a quantum
computer. This may be a pointer to proving that quantum computers are more efficient than Turing
machines.
Short Notes

MUTI-TRACK TURING MACHINE

In standard Turing machine, a single tape was used. In a multiple track TM, a single tape is assumed
to be divided into several tracks. Now the tape alphabet is required to consist of k-tuples of tape
symbols, k being the number of tracks. Hence the only difference between the standard TM and the
TM with multiple tracks is the set of tape symbols.
The language accepted by multiple track tape TM is also accepted by single tape TM.
In the case of the standard Turing machine, tape symbols are elements of Γ; in the case of TM with
multiple track, it is Γk. The moves are defined in a similar way
Example:

The R/W head is pointing to the input symbols, c in track 1, a in track 2 and b intrack 3 of tape
consisting of 3-track(multi-track) tape.
Let us assume that after reading these symbols machine moves right by replacing a by C and b by Y
and c by Z by entering into any arbitrary state say, qnext.
The transition function is:

Here the input symbols are tape symbols defined in 3 tracks. ie: Γ3 ;for example input is [c, a, b]
δ ( q, c, a, b) = (qnext, Z, X, Y, R)
The resultant tape structure is as shown below:
MULTI-TAPE TURING MACHINE

An extended TM model has some fixed number of tapes greater than one, is called Multi-tape TM.

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 transition function from Q x Гk into Q x Гk x {L, R, S}k. where k is the number of
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.
The Multi-tape TM M enters a new state.
 On each tape a new symbol is written in the cell under the head.
 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.

Example: δ(q, a, b, c) = (p, X, Y, Z, L, R, R)


NON-DETERMINISTIC TURING MACHINE

The non-deterministic Turing machine is a kind of TM in which the set of rules denote more than
one specific action reading particular input in current specific state.
A Non-deterministic TM can be formally defined as M: which is a 7-tuple, namely (Q, Σ ,Г, δ, q0.
B, F) where
Q is a finite nonempty set of states.
Г is a finite nonempty set of tape symbols,
B is the blank symbol.
Σ is a nonempty set of input symbols and is a subset of Г and B ≠ Σ
δ is the transition function mapping (q, x) onto (q‟, y, D) where D denotes the direction of
movement of R/W head: D = L or R according as the movement is to the left or right.
Q X Г → power set of Q x Г x { L/R}
q0 € Q is the initial state, and
F is the subset of Q is the set of final states.

It is clear from the definition of δ that for each state q and tape symbol X, δ( q, Г) is a set of triples
δ( q, Г) = {( q1, Г1 , R), ( q1, Г2 , L) , ( q1, Г3 , R) ………………..}

The non-deterministic TM in fact is no more powerful than the deterministic TM. Any language
accepted by non-deterministic TM can be accepted by deterministic TM.

LINEAR BOUNDED

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.. The set of
context-sensitive languages is accepted by this model.
LBA is formally defined as M: which is a 9-tuple, namely (Q, Σ ,Г, δ, q0. B, , $, F) where
Q is a finite nonempty set of states.
Г is a finite nonempty set of tape symbols,
B is the blank symbol.
Σ is a nonempty set of input symbols with two special symbols ,$ and is a subset of Г and
δ is the transition function mapping (q, x) onto (q‟, y, D) where D denotes the direction of
movement of R/W head: D = L or R according as the movement is to the left or right.
Q X Г → Q x Г x { L/R}
q0 € Q is the initial state, and
F is the subset of Q is the set of final states
ȼ is the left end marker, which is entered in the leftmost cell of the input tape and prevents the R/W
head from getting off the left end of the tape.
$ is the right end marker, which is entered in the rightmost cell of the input tape and prevents
the R/W head from getting off the right end of the tape. Both the end markers should not appear on
any other cell within the input tape. R/W head should not print any other symbol over both the end
markers.
Linear Bounded Automata Model is as shown below:

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.

RECURSIVE LANGUAGES

A language L which is a subset of Σ* is a recursively enumerable language if there exists a TM M,


such that L = T(M). ( Halt or enter into infinite loop).
That means languages accepted by a TM are called RE languages.
Structure of RE languages:
1. An algorithm has a TM that not only recognizes the language, but it tells us when it has decided
the input string is not in the language, such a TM always halts eventually regardless of whether
or not it reaches an accepting state.
2. Language consists of those RE languages that are not accepted by a TM with the guarantee of
halting. These languages are accepted in an inconvenient way ie:
i. If the is in the language, then it is accepted by TM
ii. If input is not in the language then the TM may run forever, and we shall never be sure the
input won‟t be accepted eventually.

RECURSIVE ENUMERABLE LANGUAGES

A language L which is a subset of Σ* is a recursive language if there exists a TM M, that satisfies the
following two conditions.
i. If the string w is defined in the language, then the TM accepts the string w and Halts.
ii. If the string w is not defined in the language, then the TM eventually Halts without reaching an
accepting state.

Recursive language definition assures us that TM always Halts. It is clear that a recursive language
is subset of recursively enumerable language.
Recursive languages are also called as decidable languages. The TM that always halt irrespective of
whether they accept or not is a good model for an algorithm. If an algorithm exist to solve a
problem, then the problem is decidable otherwise un-decidable if it is not a recursive language.
The existence or non-existence of an algorithm to solve a problem is often more important than the
existence some TM to solve the problem. Thus dividing the languages into decidable and un-
decidable languages is often more important than the division of languages as Recursively
enumerable( Those have some sort of TM) or non-recursively enumerable languages ( which have
no TM at all).
The relationship between the classes of languages are as shown below:
DECIDABLE and UN-DECIDABLE LANGUAGES
A language L is said to be decidable language if the corresponding language L is recursive language.
That is a problem with two answers Yes/No is decidable if the corresponding language is recursive.
The class of decidable problems is called as solvable problems. Decidability of regular languages:
Problem of testing whether a deterministic finite automaton accepts a given input string w is
decidable?. Yes it is decidable.
 The context-
 The context-
Un-decidable language: If the language L is not a recursive language, then such a language is called
un-decidable language.
If there is any language L which is recursively enumerable then there exists a TM which semi-
decides it(either accept or reject or loops forever). Every TM has description of finite length. Hence
the number of TM and number of RE languages is count-ably infinite.
 ATM = {(M, w) | The TM M accepts w} is un-decidable.
 Halting problem of TM is un-decidable.

THE POST CORRESPONDENCE PROBLEM


The un-decidability of strings can be determined with the help of Post Correspondence problem
(PCP). The PCP can be defined as:
The post correspondence problem consists of two lists of strings that are equal length over the input
Σ. The two lists are:
X = ( x1, x2, x3, x4,……………………. xn)
Y = ( y1, y2, y3, y4,……………………. yn)
We say that there exists a post correspondence solution for pair (X, Y) if there is a non-empty
sequence of integers i1,i2……………im such that
x1 x2…………………….xn = y1 y2…………………….yn where 1 ≤ ij ≤ n
To solve the Post correspondence problem we try all the combination of sequences
i1,i2……………im ;The indices ij need not be distinct and m may be greater than n.
To find xi = yi then we say that PCP has a solution.
If there exists a solution to PCP, then there exist infinitely many solutions.

Example:
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

HALTING PROBLEM OF TURING MACHINE

The halting problem is a critical problem in computability theory. It is the theoretical problem of
determining whether a computer program will halt (produce an answer) or loop forever on a given
input. In 1936, Alan Turing proved that the halting problem is un-decidable, and therefore, cannot be
solved.
One can determine the decidability of other computational problems by combining reduction
techniques and the un-solvability of the halting problem. Reduction technique is used to prove the
un-decidability of halting problem of Turing machine.

For example, if A is the problem of finding some root of x4 - 3x2 + 2 = 0 and B is the problem of
finding some root of x2 - 2 = 0, then A is reducible to B. As x2 - 2 is a factor of x4 - 3x2 + 2 a root of
x2 - 2 = 0 is also a root of x4 - 3x2 + 2 = 0
If A is reducible to Band B is decidable then A is decidable. If A is reducible to B and A is un-
decidable then B is un-decidable.
It is not possible to find the answer for halting problem by simulating the action of TM on string w
by universal TM, because there is no limit on the length of the computation. If M enters into an
infinite loop, then no matter how long we wait, we can never be sure that M is in fact in a loop. The
machine may be in a loop because of very long computation. What is required is an algorithm that
can determine the correct answer for any M and w by performing some analysis on the machine‟s
description and the input.

Formally the Halting problem of TM is stated as “given arbitrary TM M = (Q, Σ ,Г, δ, q0. B, F) and
the input w € Σ*, does M halt on input w?”
Thus the Halting problem of a TM M is a collection of strings (language) having a format called (M,
w) in such a way that TM M with input strings w. If M halts on w then really M is a TM and w is
some input string. We collect all (M, w) strings in the form of language. The haltingproblem of a
TM is un-decidable.
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)).

P problem:
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
A language L is in class P if there exists some polynomial T(n) such that L = T(M) for some
deterministic TM M of time complexity T(n).
Construct the time complexity T(n) for the Turing machine M to accept the language L = {an bn | n
≥ 1}
 TM Consists of going through the input string (anbn) 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 one a
with one b.
 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
A language L is in class NP if there is a non-deterministic TM M and a polynomial time complexity
T(n) such that L = T(M and M executes at most T(n) moves for every input w of length n.
We have seen that a deterministic TM M1 simulating a non-deterministic TM M exists. If T(n) is
time complexity of M, then the complexity of the equivalent deterministic TM M1 is 2O(T(n))

COMPLEXITY of an ALGORITHM

The efficiency of an algorithm can be decided by measuring the performance of an algorithm.


We can measure the performance of an algorithm by computing two factors:
1. Amount of time required by an algorithm to execute
2. Amount of storage required by an algorithm.

Hence we define two terms- Time complexity and space complexity.


Time complexity: of an algorithm means the amount of time taken by algorithm to run. By
computing time complexity we come to know whether the algorithm is slow or fast.
Space complexity of an algorithm means the amount of space (memory) taken by an algorithm. By
computing space complexity we can analyze whether an algorithm requires more or less space.
To select the best algorithm, we need to check efficiency of each algorithm. The efficiency can be
measured by computing time complexity of each algorithm. Asymptotic notations such as Ω,
Ѳ and O is the shorthand way to represent the time complexity. Using this notation we can give time
complexity as “fastest possible”, ”slowest possible or average time.
Big Oh Notation: The Big oh notation is denoted by O is 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.
When we have two algorithms for the same problem, we may require a comparison between the
running times of these two algorithms.
Measuring the performance of an algorithm in relation with the input size ‘n’ is called order of
growth. In particular the exponential function grows at a very fast rate when compared to any
polynomial of large degree. We prove a precise statement comparing the growth rate of polynomials
and exponential function.
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:
A language L is in class P if there exists some polynomial T(n) such that L = T(M) for some
deterministic TM M of time complexity T(n). In the case of an algorithm T(n) denotes the running
time for solving a problem with an input of size n.
We have seen that a deterministic TM M1 simulating a non-deterministic TM M exists. If T(n) is
time complexity of M, then the complexity of the equivalent deterministic TM M1 is 2O(T(n)) It is not
known whether the complexity of M1 is less than 2O(T(n))

.
QUANTUM COMPUTER

A quantum computer is a system that built from quantum circuits, containing wires and elementary
quantum gates, to carry out manipulation of quantum information.
A classical computer has a memory made up of bits of 0 and 1. The quantum computers maintain a
sequence of qubits that can be represented mathematically as:
|ψ> = α|0> + β|0>

The classical computer bits have two states 0 and 1.The two possible states for a qubit are the states:
|0 > and |1 >. Qubit is represented using the notation | >. Qubit can be in infinite number of states
other than | 0 > and | 1 >. It can be in state
|ψ> = α|0> + β|0>

Where α and β are complex numbers such that


|α|2 + |β|2 = 1
The 0 and 1 are called the computational basis states and |ψ> is called a superposition
|ψ> = α|0> + β|0>
Multiple qubits can be defined.
Example: Two qubit systems has 4 basis states
|00> |01> |10 > |11 >
|ψ> = α00 |00> + α01 |01> + α10 |10> + α11 |11> with |α00|2 + |α01|2 + |α10|2 + |α11|2 =1

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:

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. 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-Turing thesis, as: Any algorithmic process can be simulated efficiently using a non-
deterministic Turing machine.
Later in 1985 David Deutsch tried to build computing devices using quantum mechanics in such a
way that computers are physical objects, and computations are physical process. What computers
can or cannot compute is determined by the law of physics alone, and not by pure mathematics. But
it is not known Deutsch‟s notion of universal quantum computer will efficiently simulate any
physical process. In 1994 Peter Shor proved that any problem could be solved by a quantum
computers are more efficient than Turing machines and classical Universal Turing Machine 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 Turing machine to be
simulated as well as the input thereof from its own tape.
The language accepted by the Universal TM is called a universal language. It contains multiple
tapes. Single TM can be used as a stored program computer, taking its program as well as its data
from one or more tapes on which input is placed. The same idea is implemented in Universal TM. It
is easiest to describe universal TM U as a multi-tape TM with transitions of M are stored initially on
the first tape, along with the string w. A second tape will be used to hold the simulated tape of M,
using the same format as for the code of M. That is tape symbol Xi of M will be represented by 0i,
and tape symbol will be separated by single 1‟s, the third tape of U holds the state of M, with state qi
represented by i 0‟s. The universal TM U accepts the coded pair (M, w) if and only if M accepts w.
If M rejects w then the machine U also rejects w. Also if the machine M for input w enters a loop
forever, then U also does the same.

You might also like