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

Unit VI_19-20

The document discusses concepts related to recursive and recursively enumerable languages, algorithm definitions, and the Church-Turing thesis. It highlights the undecidability of certain problems, such as the halting problem, and explores the relationships between different complexity classes, including P, NP, NP-complete, and NP-hard. Additionally, it emphasizes the distinction between solvable and unsolvable problems in computational theory.

Uploaded by

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

Unit VI_19-20

The document discusses concepts related to recursive and recursively enumerable languages, algorithm definitions, and the Church-Turing thesis. It highlights the undecidability of certain problems, such as the halting problem, and explores the relationships between different complexity classes, including P, NP, NP-complete, and NP-hard. Additionally, it emphasizes the distinction between solvable and unsolvable problems in computational theory.

Uploaded by

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

Unit VI TY 2017 PAT

• Course Content- Recursively Enumerable and


Recursive, Properties of recursive and
recursively enumerable languages, Post
correspondence problem, Undecidability:
Reducing one problem to another, Other
unsolvable Problems. Tractable and In
Tractable Problems.
DEFINITION OF AN ALGORITHM
• Procedure (finite sequence of instructions which
can be mechanically carried out) that terminates
after a finite number of steps for any input.
• In 1900, the mathematician David Hilbert averred
that every definite mathematical problem must
be susceptible for an exact settlement either in
the form of an exact answer or by the proof of
the impossibility of its solution
DEFINITION OF AN ALGORITHM
• Hilbert identified 23 mathematical problems as a
challenge for future mathematicians; only 10 of the
problems have been solved so far.

• His tenth problem was to devise 'a process according to


which it can be determined by a finite number of
operations‘, whether a polynomial over Z has an integral
root.

• This was not answered until 1970


TM as a Theoretical Model
• 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 TM.

• TM arose as an ideal theoretical model for an algorithm.

• The TM provided a machinery to mathematicians for attacking


the Hilberts' tenth problem which can be restated as follows:
does there exist a TM that can accept a polynomial over n
variables if it has an integral root and reject the polynomial if
it does not have one
TM as a Theoretical Model
• In 1970, Yuri Matijasevic. after studying the work of
Martin Davis, Hilary Putnam and Julia Robinson
showed that no such algorithm (Turing machine)
exists for testing whether a polynomial over n
variables has integral roots.

• It is universally accepted by computer scientists that


Turing machine is a mathematical model of an
algorithm
LANGUAGE ACCEPTABILITY BY TM
• Turing machine M halts when
– When M reaches a final state
– If that δ(q, a) transition is undefined
• There are TMs that never halt on some inputs
in any one of these ways
• 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.
RECURSIVE LANGUAGE (REC)
• A language L ⊆ ⅀* is recursive if there exists some TM
M that:
1. If w ϵ L then M accepts w (that is it reaches an accepting
state on processing w) and halts.
2. If w ∉ L then M halts without reaching an accepting state.
• So a TM modelling a recursive language always halts
eventually just as an algorithm eventually terminates.
• e.g. L= {anbncn|n>=1} is recursive because we can
construct a TM which will enter final state if wis of
form anbncnelse move to non-final state and halt
DECIDABILITY (SOLVABLE PROBLEMS)
• A problem with two answers (Yes/No) is
decidable if the corresponding language is
recursive. In this case, the language L is also
called decidable/ Turing decidable
• A problem /language is undecidable if it is not
decidable.
• A decidable problem is called a solvable
problem and an undecidable problem an
unsolvable problem by some authors.
Recursive Enumerable (RE) or Type -0
Language
• An RE language can be accepted or recognized
by Turing machine which means it will enter
into final state for the strings of language and
may or may not enter into rejecting state for
the strings which are not part of the language.
• It means TM can loop forever for the strings
which are not a part of the language.
• RE languages are also called as Turing
recognizable/acceptable languages.
Relationship between RE and REC
languages
Prove that every recursive language is
recursively enumerable
• Let us assume that TM M decides language L
• We can always construct a TM M1 from M
that accepts the language L
• In M1 we make the rejecting states of M as
non-halting state, from which the machine is
guaranteed to never halt
• Thus for any string w Є L , both M and M1 will
halt accepting it
• And if w doesn’t belong to L, M will halt while
M1 will loop forever
Closure Properties of Recursive Languages

• Union: If L1 and If L2 are two recursive languages, their


union L1∪L2 will also be recursive because if TM halts
for L1 and halts for L2, it will also halt for L1∪L2.
• Concatenation: If L1 and If L2 are two recursive
languages, their concatenation L1.L2 will also be
recursive. For Example:
L1= {anbncn|n>=0}
L2= {dmemfm|m>=0}
L3= L1.L2 = {anbncndm emfm|m>=0 and n>=0} is also
recursive.
Show that for two recursive languages L1 , L2
L1 U L2 is recursive language

W Є ⅀*
M1
M3
M2

• Let M1 decide L1 and M2 decide L2


• Output of M1 is written on the tape of M3
• Output of M2 is written on the tape of M3
• M3 returns Y as output if atleast one of the
outputs of M1 or M2 is “Y”
Show that for two recursive languages L1 , L2
L1 ∩ L2 is recursive language

W Є ⅀*
M1
M3
M2

• Let M1 decide L1 and M2 decide L2


• Output of M1 is written on the tape of M3
• Output of M2 is written on the tape of M3
• M3 returns Y as output if both outputs of M1 or
M2 is “Y” otherwise returns “N”
Show that for a recursive language L, its
Complement is also recursive

• Let M decide L
• Let M1 decide L’s complement
• Let all accepting states of M be rejecting states
in M1 and rejecting states in M be accepting
states in M1
Closure Properties of Decidable & Turing
Recognizable Languages
Operation Decidable Turing Recognizable
Union Y Y
Intersection Y Y
Concatenation Y Y
Star Y Y
Complement Y N
Problem Solving as Language Recognition

• Consider the following problem:


Is the longest of the distances
between two nodes(i.e. the
diameter) of a given graph less than
a given integer k ? Here the distance
is the smallest number of edges (or
hops) between the nodes.

• Some of the instances of this


problem are as shown

• Instance 1 asks whether or not the


diameter of the given graph with one
edge and two nodes is less than 1.
Instance 2 asks whether or not the
diameter of the given graph with
four edges and four nodes is less
than 2. Similarly for Instance 3.
Problem Solving as Language Recognition

• These problem instances can be represented by a string as follows:


Instance 1: 1,2;(1,2);1
Instance 2: 1,2,3,4;(1,2)(1,3)(1,4)(3,4);2
Instance 3: 1,2,3,4;(1,2)(1,3)(1,4)(2,3)(2,4)(3,4);3

Here the set of nodes, the set of edges and k are separated by ; in that order in the strings.

• The solutions to these instances are: Instance 1: No Instance 2: No Instance 3: Yes

• There are infinitely many 'Yes' instances and 'No' instances for this problem.

• The set of 'Yes' instances is a language and so is the set of 'No' instances as well as the set
of all instances and many others for this problem.
Problem Solving as Language Recognition

• We can thus see that solving the problem for a given instance is equivalent to checking
whether or not the string representing the given instance belongs to the language of
'Yes' instances of the problem.

• That is, the problem solving is the same as the language recognition.

• A problem can be solved if and only if the language of its 'Yes' instances is recognizable
or decidable by a Turing machine.

• It is not solvable if the language is merely acceptable but not recognizable, or even worse
if it is not even acceptable.
Unsolvable Problems
• We have learned that deterministic Turing machines are
capable of doing any computation that computers can do,
that is computationally they are equally powerful, and that
any of their variations do not exceed the computational
power of deterministic Turing machines.

• It is also conjectured that any "computation" human beings


perform can be done by Turing machines (Church's thesis).

• However there are problems that can not be solved by Turing


machines hence by computers.
What is Unsolvability?
• Solving a problem can be viewed as recognizing a language.
So unsolvability in terms of language recognition is:
• Suppose that a language is acceptable but not decidable.
• Then given a string a Turing machine that accept the language
starts the computation.
• At any point in time, if the Turing machine is running, there is
no way of telling whether it is in an infinite loop or along the
way to a solution and it needs more time.
• Thus if a language is not decidable, the question of whether
or not a string is in the language may not be answered in any
finite amount of time.
• Since we can not wait forever for an answer, the question is
unanswerable that is the problem is unsolvable.
Halting Problem
• One of well known unsolvable problems is the
halting problem. It asks the following
question:
• Given an arbitrary Turing machine M over
alphabet = { a , b } , and an arbitrary string w
over sigma , does M halt when it is given w as
an input ?
• It can be shown that the halting problem is
not decidable, hence unsolvable.
Undecidable Problems
• The following problems about Turing
machines are undecidable.
– Given M and a string w, does M halt on w?
– Given M, does M halt on the empty tape?
– Given M, is there any string at all on which M
halts?
– Given M, does M halt on every input string?
– Given M1 and M2, do they halt on same input
strings?
Summary..
• Some problems are unsolvable by Turing machines hence
by computers.
• No one can write computer programs that solve those
problems and halt after a finite amount of time.
• A problem is solvable if some Turing machine can solve it
in finite time.
• Even if it takes a million years to solve a problem, it is still
solvable.
• However, in practice if it takes a million years, it is as good
(or bad) as unsolvable.
• For many problems a day or even an hour would be too
long
Time Complexity of Problems
• Researchers who work in Complexity Theory often
concentrate on decision problems.
• A decision problem is one whose return values are
either YES or NO (or true or false, or 0 or 1).
• The hierarchy of solvable problems based on the
computation time required to solve them
– P class
– NP class
– NP complete
– NP Hard
Complexity Class P
• Definition: The complexity class P is the set of all
decision problems that can be solved with worst-
case polynomial time-complexity.
• In other words, a problem is in the class P if it is a
decision problem and there exists an algorithm
that solves any instance of size n in O(n^k ) time,
for some integer k.
• So P is just the set of decision problems: the
decision problems for which we have polynomial-
time algorithms
Examples
• Linear Search
• Sorting
• Minimum Spanning Tree
• Question :
Given an array {1,4,7,3,2….n} Is there any x,y
in the above array so that x+y = 10?
– Is this problem P class?
Complexity Class NP
• Definition: The complexity class NP is the set
of all decision problems with polynomial time
checking algorithm
• Given a solution we can check in a polynomial
time if that solution is what we are looking for
• Example : A clique problem in graph
P Subset of NP?

Sorting
Complexity Class NP Hard
• A problem is NP Hard if all other NP problems
can be polynomially reduced to it
• A problem is NP complete if it is NP Hard and
in NP

You might also like