Title: RAJALAKSHMI ENGINEERING COLLEGE
1 RAJALAKSHMI ENGINEERING COLLEGE
THEORY OF COMPUTATION
2UNIT- I
3(No Transcript)
4(No Transcript)
5(No Transcript)
6(No Transcript)
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15Finite Automata
16(No Transcript)
17- States
- Open
- Closed
- Sensors
- Front Someone on the Front pad
- Rear Someone on the Rear pad
- Both Someone on both the pads
- Neither No one on either pad
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)
22(No Transcript)
23(No Transcript)
24(No Transcript)
25(No Transcript)
26(No Transcript)
27(No Transcript)
28(No Transcript)
29(No Transcript)
30(No Transcript)
31(No Transcript)
32(No Transcript)
33(No Transcript)
34(No Transcript)
35(No Transcript)
36(No Transcript)
37(No Transcript)
38(No Transcript)
39(No Transcript)
40(No Transcript)
41UNIT - II
- REGULAR EXPRESSIONS
- AND
- LANGUAGES
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47(No Transcript)
48(No Transcript)
49(No Transcript)
50(No Transcript)
51(No Transcript)
52(No Transcript)
53(No Transcript)
54(No Transcript)
55(No Transcript)
56(No Transcript)
57(No Transcript)
58(No Transcript)
59(No Transcript)
60(No Transcript)
61(No Transcript)
62(No Transcript)
63(No Transcript)
64(No Transcript)
65(No Transcript)
66(No Transcript)
67(No Transcript)
68(No Transcript)
69(No Transcript)
70(No Transcript)
71(No Transcript)
72(No Transcript)
73(No Transcript)
74(No Transcript)
75(No Transcript)
76(No Transcript)
77(No Transcript)
78(No Transcript)
79(No Transcript)
80Questions about Regular Languages
81Question contd
82Singleton Languages are Regular
83Finite Languages are regular
84(No Transcript)
85(No Transcript)
86(No Transcript)
87(No Transcript)
88(No Transcript)
89Closure Properties for Regular Languages
90Myhill-Nerode Theorem
91(No Transcript)
92(No Transcript)
93(No Transcript)
94UNIT III
- CONTEXT-FREE GRAMMAR
- AND
- LANGUAGES
95Context Free Grammars
96Cont
97Cont
98Defining CFG
99Notational conventions For CFGs
100OTHER CFG EXAMPLES
101Languages of CFG
102Languages of CFG
103Regular Languages and CFL
104Translating FAs into CFG
105Formalizing the Translation
106Closure Properties of CFL
107Proving CFLs closed under Union
108IDEA
109Formal Construction of Gu
110Derivations
111Sentential Form
112Left Most and Right Most Derivation
113Right-Linear Grammars
114Ambiguous Grammars
115Ambiguous Grammars
116Pushdown Automata
- Recall our study of regular languages.
- They were defined in terms of regular expressions
(syntax). - We then showed that FAs provide the computational
power - needed to process them.
- We would like to mimic this line of development
for CFLs. - We have a syntactic definition of CFLs in terms
of CFGs. - What kind of computing power is needed to
process (i.e. - recognize) CFLs?
- Do FAs suffice?
117Cont
118Cont
119Example PDA for0n1nn0
120Formal Definition
121Instantaneous Description
122Language accepted by PDA
123Language accepted by PDA
124Language accepted by PDA
125Equivalence of CFGs and PDAs
126Cont
127Deterministic PDA
128UNIT - IV
- PROPERTIES
- OF
- CONTEXT-FREE LANGUAGES
129Chomsky Normal Form
130Defining CNF
131What is the Big Deal about CNF?
132Cont
133Converting CFGs into CNF
134Eliminating e-Productions
135Cont
136Cont
137Nullability
138Generating an e-Production-free CFGs
139Converting CFGs into CNF
140Eliminating Unit Productions
141Cont
142U(G,A) and New Productions
143Example
144Cont
145Formal Construction
146Eliminating Terminal Productions
147Example
148Formal Construction
149Pumping Lemma For CFLs
150Cont
151Derivation Trees
152Defining Derivation Tree
153Example
154Derivation Trees and CNF
155(No Transcript)
156Pumping Lemma for CFL
157Proving Languages Non Context Free using Pumping
Lemma
158Prove that L aNbNcNN 0 is Not a CFL
159Proof Cont
160Turing Machines
161A Finite Automaton
162A Pushdown Automaton
163A Turing Machine
164Cont..
165Differences
166Example
167Cont
168Cont
169Cont
170Formal Definition
171Cont..
172Cont
173Cont
174Configurations
175Cont
176More Configuration
177Accepting a Language
178Enumerable Languages
179UNIT V
180Enumerable Languages
181Enumerable Languages
182Example
183Example
184Example
185Element Distinctness
186Element Distinctness
187Element Distinctness
188Element Distinctness
189Element Distinctness
190Variants
191Multitape Turing Machine
192Equivalence
193Simulation
194Simulation
195Non Deterministic Turing Machine
196Decidability
197Example
198Theorem
199Theorem
200Theorem
201Theorem
202Halting Problem
203Cont..
204Cont..
205Turing Machines are countable
206Cont..
207Post Correspondence Problem
208Cont
209Cont...
210Cont
211Cont
212Cont
213(No Transcript)
214NP-complete Problem
215(No Transcript)
216(No Transcript)
217Decision Problems To keep things simple, we
will mainly concern ourselves with decision
problems. These problems only require a single
bit output yes'' and no''. How would you
solve the following decision problems? Is
this directed graph acyclic? Is there a
spanning tree of this undirected graph with
total weight less than w? Does this
bipartite graph have a perfect (all nodes
matched) matching? Does the pattern p
appear as a substring in text t?
218(No Transcript)
219P P is the set of decision problems that can be
solved in worst-case polynomial time If
the input is of size n, the running time must be
O(nk). Note that k can depend on the
problem class, but not the particular instance.
All the decision problems mentioned above are
in P.
220Nice Puzzle The class NP (meaning
non-deterministic polynomial time) is the set of
problems that might appear in a puzzle magazine
Nice puzzle.'' What makes these problems
special is that they might be hard to solve, but
a short answer can always be printed in the back,
and it is easy to see that the answer is correct
once you see it. Example... Does matrix A have
an LU decomposition? No guarantee if answer is
no''.
221(No Transcript)
222NP Technically speaking A problem is in
NP if it has a short accepting certificate.
An accepting certificate is something that we can
use to quickly show that the answer is yes''
(if it is yes). Quickly means in polynomial
time. Short means polynomial size. This
means that all problems in P are in NP (since we
don't even need a certificate to quickly show the
answer is yes''). But other problems in NP
may not be in P. Given an integer x, is it
composite? How do we know this is in NP?
223Good Guessing Another way of thinking of NP is
it is the set of problems that can solved
efficiently by a really good guesser. The
guesser essentially picks the accepting
certificate out of the air (Non-deterministic
Polynomial time). It can then convince itself
that it is correct using a polynomial time
algorithm. (Like a right-brain, left-brain sort
of thing.) Clearly this isn't a practically
useful characterization how could we build such
a machine?
224Exponential Upperbound Another useful property
of the class NP is that all NP problems can be
solved in exponential time (EXP). This is
because we can always list out all short
certificates in exponential time and check all
O(2nk) of them. Thus, P is in NP, and NP is in
EXP. Although we know that P is not equal to EXP,
it is possible that NP P, or EXP, or neither.
Frustrating!
225NP-hardness As we will see, some problems are
at least as hard to solve as any problem in NP.
We call such problems NP-hard. How might we
argue that problem X is at least as hard (to
within a polynomial factor) as problem Y? If X
is at least as hard as Y, how would we expect an
algorithm that is able to solve X to behave?
226(No Transcript)
227(No Transcript)
228(No Transcript)
229(No Transcript)
230co-NP
NP
P
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-c
omplete 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
PNP.
231(No Transcript)
232(No Transcript)
233(No Transcript)
234(No Transcript)
235(No Transcript)
236NP-Complete Problems
237(No Transcript)
238(No Transcript)
239(No Transcript)
240(No Transcript)
241(No Transcript)
242(No Transcript)