0% found this document useful (0 votes)
172 views109 pages

Theory of Computation - CS3452 - Notes

Uploaded by

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

Theory of Computation - CS3452 - Notes

Uploaded by

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

Civil

CSE
Home Mech
e
EEE
ECE

2nd Semester 3rd Semester


1st Semester
Professional English II Discrete Mathematics
Professional English I
Statistics and Numerical
Methods Digital Principles and
Matrices and Calculus
Computer Organization
Engineering Graphics
Engineering Physics
Foundation of Data
Physics for Information
Science Science
Engineering Chemistry

Physics
Basic for Engineering
Electrical and Data Structure
Problem Solving and Science Engineering
Electronics
Python Programming Object Oriented
Programming in C
Programming

4th Semester 5th Semester 6th Semester


Theory of Computation Computer Networks Object Oriented Software
Engineering
Artificial Intelligence Compiler Design
and Machine Learning Embedded Systems IoT
Cryptography and
Database Management Cyber Security Open Elective I
System
Professional Elective III
Algorithms Distributed Computing
Professional Elective IV

Introduction to Operating Professional Elective I Professional Elective V


Systems
Professional Elective II Professional Elective VI
Environmental Sciences
and sustainability Mandatory Course I Mandatory Course II

7th Semester 8th Semester


Human Values and Ethics Project Work/Internship

Elective-Management

Professional Elective II

Professional Elective III

Professional Elective IV
1

www.Poriyaan.in
2

www.Poriyaan.in
3

www.Poriyaan.in
4

www.Poriyaan.in
5

www.Poriyaan.in
6

www.Poriyaan.in
7

www.Poriyaan.in
8

www.Poriyaan.in
9

www.Poriyaan.in
10

www.Poriyaan.in
11

www.Poriyaan.in
12

www.Poriyaan.in
13

www.Poriyaan.in
14

www.Poriyaan.in
15

www.Poriyaan.in
16

www.Poriyaan.in
17

www.Poriyaan.in
18

www.Poriyaan.in
19

www.Poriyaan.in
20

www.Poriyaan.in
21

www.Poriyaan.in
22

www.Poriyaan.in
23

www.Poriyaan.in
24

www.Poriyaan.in
25

www.Poriyaan.in
26

www.Poriyaan.in
27

www.Poriyaan.in
28

www.Poriyaan.in
29

www.Poriyaan.in
30

www.Poriyaan.in
31

www.Poriyaan.in
32

www.Poriyaan.in
33

www.Poriyaan.in
34

www.Poriyaan.in
35

www.Poriyaan.in
36

www.Poriyaan.in
37

www.Poriyaan.in
38

www.Poriyaan.in
39

www.Poriyaan.in
40

www.Poriyaan.in
41

www.Poriyaan.in
42

www.Poriyaan.in
43

www.Poriyaan.in
44

www.Poriyaan.in
45

www.Poriyaan.in
46

www.Poriyaan.in
47

www.Poriyaan.in
48

www.Poriyaan.in
49

www.Poriyaan.in
50

www.Poriyaan.in
51

www.Poriyaan.in
52

www.Poriyaan.in
53

www.Poriyaan.in
54

www.Poriyaan.in
55

www.Poriyaan.in
56

www.Poriyaan.in
57

www.Poriyaan.in
58

www.Poriyaan.in
59

www.Poriyaan.in
60

www.Poriyaan.in
61

www.Poriyaan.in
62

www.Poriyaan.in
63

www.Poriyaan.in
64

www.Poriyaan.in
65

www.Poriyaan.in
66

www.Poriyaan.in
67

www.Poriyaan.in
68

www.Poriyaan.in
69

www.Poriyaan.in
70

www.Poriyaan.in
71

www.Poriyaan.in
72

www.Poriyaan.in
73

www.Poriyaan.in
74

www.Poriyaan.in
75

www.Poriyaan.in
76

UNIT NO: 5 NAME: UNDECIDABILITY

Design a Turing machine to add two given integers.


Solution:

Some unsolvable Problems are as follows:


(i) Does a given Turing machine M halts on all input?
(ii) Does Turing machine M halt for any input?
(iii) Is the language L(M) finite?
(iv) Does L(M) contain a string of length k, for some given k?
(v) Do two Turing machines M1 and M2 accept the same language?
It is very obvious that if there is no algorithm that decides, for an arbitrary given Turing machine
M and input string w, whether or not M accepts w. These problems for which no algorithms exist
are called “UNDECIDABLE” or “UNSOLVABLE”.

Code for Turing Machine:

STUDENTSFOCUS.COM

www.Poriyaan.in
77

STUDENTSFOCUS.COM

www.Poriyaan.in
78

Diagonalization language:

This table represents language acceptable by Turing machine

STUDENTSFOCUS.COM

www.Poriyaan.in
79

Proof that Ld is not recursively enumerable:

Recursive Languages:

STUDENTSFOCUS.COM

www.Poriyaan.in
80

STUDENTSFOCUS.COM

www.Poriyaan.in
81

Universal
Language:

STUDENTSFOCUS.COM

www.Poriyaan.in
82

Undecidability of Universal Language:

STUDENTSFOCUS.COM

www.Poriyaan.in
83

Class p-problem solvable in polynomial time:

Non deterministic polynomial time:


A nondeterministic TM that never makes more than p(n) moves in any sequence of choices for
some polynomial p is said to be non polynomial time NTM.
  NP is the set of languags that are accepted by polynomial time NTM’s 
 Many problems are in NP but appear not to be in p. 
 One of the great mathematical questions of our age: is there anything in NP that is not in p? 
NP-complete problems: 
If We cannot resolve the “p=np question, we can at least demonstrate that certain problems in NP
are the hardest , in the sense that if any one of them were in P , then P=NP. 
  These are called NP-complete. 
 Intellectual leverage: Each NP-complete problem’s apparent difficulty reinforces the belief
that they are all hard. 
Methods for proving NP-Complete problems:
 Polynomial time reduction (PTR): Take time that is some polynomial in the input size to
 convert instances of one problem to instances of another. 
 If P1 PTR to P2 and P2 is in P1 the so is P1. 
  Start by showing every problem in NP has a PTR to Satisfiability of Boolean formula. 
 Then, more problems can be proven NP complete by showing that SAT PTRs to them
directly or indirectly. 

STUDENTSFOCUS.COM

www.Poriyaan.in
84

UndecidableProblem about Turing


Machine

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 1

www.Poriyaan.in
85

• Reduction is a technique in which if a problem P1 is


reduced to a problem P2 then any solution of P2 solves
P1. In general, if we have an algorithm to convert an
instance of a problem P1 to an instance of a problem P2
that have the same answer then it is called as P1 reduced
P2.
• Hence if P1 is not recursive then P2 is also not
recursive. Similarly, if P1 is not recursively enumerable
then P2 alsois not recursively enumerable.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 2

www.Poriyaan.in
86

• Theorem: if P1 is reduced to P2 then


• If P1 is undecidable, then P2 is also undecidable.
• If P1 is non-RE, then P2 is also non-RE.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 3

www.Poriyaan.in
87

Proof:
• Consider an instance w of P1. Then construct an algorithm such
that the algorithm takes instance w as input and converts it into
another instance x of P2. Then apply that algorithm to check
whether x is in P2.
• If the algorithmanswer 'yes' then that means x is in P2, similarly
we can also say that w is in P1. Since we have obtained P2 after
reduction of P1. Similarly if algorithm answer 'no' then x is not
in P2, that also means w is not in P1. This proves that if P1 is
undecidable, thenP1is also undecidable.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 4

www.Poriyaan.in
88

• There are two types of languages empty and nonempty


language. Let Le denotes an empty language, and
Lne denotes non empty language. Let w be a binary
string, and Mi be a TM. If L(Mj) = Ф then Mi does not
accept input then w is in Le. Similarly, if L(Mj) is not the
emptylanguage, thenwis in Lne. Thuswecansaythat

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 5

www.Poriyaan.in
89

• Le = {M | L(M) = Ф}
Lne = {M | L(M) ≠ Ф}
• Both Le and Lne are the complement of one another.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 6

www.Poriyaan.in
90

Post CorrespondanceProblem

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 1

www.Poriyaan.in
91

• The Post Correspondence Problem (PCP) was invented


by Emil Post in 1946. It is called as an undecidable
decision problem. The PCP problem rather than an
alphabet ∑ is considered
• Given the following two lists,MandNof non-empty
strings over ∑ −
• M = (x1, x2, x3,………, xn)
• N = (y1, y2, y3,………, yn)

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 2

www.Poriyaan.in
92

• The Post Correspondence Solution, if for some


i1,i2,………… ik, where 1 ≤ ij ≤ n, the condition xi1 …….xik =
yi1 …….yik satisfies.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 3

www.Poriyaan.in
93

Example
• M = (abb, aa, aaa) and N = (bba, aaa, aa)
• Include a Post Correspondence Solution?
• Solution
• x1x2x3MAbbaaaaaNBbaaaaaa

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 4

www.Poriyaan.in
94

The Class P

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 1

www.Poriyaan.in
95

• Definition: The complexity class P is the set of all


decision problems that can be solved with worst-case
polynomial time-complexity.
• Aproblem is in the class P if it is a decision problemand
there exists an algorithmthat solves any instanceof size
nin O(nk ) time, forsomeintegerk.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 2

www.Poriyaan.in
96

• Strictly, n must be the number of bits needed for a


‘reasonable’ encoding of the input. But we won’t get
boggeddownin suchfinedetails.
• So P is just the set of tractable decision problems: the
decision problems for which we have polynomial-time
algorithms.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 3

www.Poriyaan.in
97

• The problems in the picture that are in NP but not in P


are ones that we’re not sure about: –
• there is no known polynomial-time algorithm; –
• but no proof of intractability.

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 4

www.Poriyaan.in
98

• We know that P ⊆ NP. But much more than that we


don’t know.
• The definition of NP allows for the inclusion of
problems thatmay not be in P. But it may turn out that
therearenosuchproblemsandthat P= NP

10/11/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 5

www.Poriyaan.in
99

The Class P and NP

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 1

www.Poriyaan.in
100

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 2

www.Poriyaan.in
101

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 3

www.Poriyaan.in
102

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 4

www.Poriyaan.in
103

co-NP
NP

One of the central (and widely and intensively studied 30 years) problems of
(theoretical) computer science is to prove that
(a) P NP (b) NP co-NP.
All evidence indicates that these conjectures are true.
Disproving any of these two conjectures would not only be considered truly
spectacular, but would also come as a tremendous surprise (with a variety of far-
reaching counterintuitive consequences).

NP-complete: Collection Z of problems is NP-complete if (a) it is NP and (b) if


polynomial-time algorithm existed for solving problems in Z, then P=NP.

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 5

www.Poriyaan.in
104

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 6

www.Poriyaan.in
105

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 7

www.Poriyaan.in
106

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 8

www.Poriyaan.in
107

10/10/2019 SNSCE/CSE/CS8501/TOC/Ms.F.Margret Sharmila 9

www.Poriyaan.in
Civil
CSE
Home Mech
e
EEE
ECE

2nd Semester 3rd Semester


1st Semester
Professional English II Discrete Mathematics
Professional English I
Statistics and Numerical
Methods Digital Principles and
Matrices and Calculus
Computer Organization
Engineering Graphics
Engineering Physics
Foundation of Data
Physics for Information
Science Science
Engineering Chemistry

Physics
Basic for Engineering
Electrical and Data Structure
Problem Solving and Science Engineering
Electronics
Python Programming Object Oriented
Programming in C
Programming

4th Semester 5th Semester 6th Semester


Theory of Computation Computer Networks Object Oriented Software
Engineering
Artificial Intelligence Compiler Design
and Machine Learning Embedded Systems IoT
Cryptography and
Database Management Cyber Security Open Elective I
System
Professional Elective III
Algorithms Distributed Computing
Professional Elective IV

Introduction to Operating Professional Elective I Professional Elective V


Systems
Professional Elective II Professional Elective VI
Environmental Sciences
and sustainability Mandatory Course I Mandatory Course II

7th Semester 8th Semester


Human Values and Ethics Project Work/Internship

Elective-Management

Professional Elective II

Professional Elective III

Professional Elective IV

You might also like