1
9/9/2024
Sri Raghavendra Educational Institutions Society (R)
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
www.skit.org.in
Department of Computer Science & Engineering
SUBJECT CODE:BCS503
SUBJECT NAME:THEORY OF COMPUTATION
MODULE-1
2
9/9/2024
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
INTRODUCTION TO AUTOMATA THEORY
3
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
What is Automata Theory?
4
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Alan Turing (1912-1954)
5
(A pioneer of automata theory)
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Theory of Computation: A Historical Perspective
6
1930s
1940-1950s
1969
Cook introduces “intractable” problems� or “NP-Hard” problems
1970-
Modern computer science: compilers, �computational & complexity theory evolve
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Languages & Grammars
7
Or “words”
Image source: Nowak et al. Nature, vol 417, 2002
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
The Chomsky Hierarchy
8
Regular
(DFA)
Context-�free
(PDA)
Context-�sensitive �(LBA)
Recursively-�enumerable �(TM)
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
The Central Concepts of Automata Theory
9
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Alphabet
An alphabet is a finite, non-empty set of symbols
10
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Strings
A string or word is a finite sequence of symbols chosen from ∑
11
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Powers of an alphabet
Let ∑ be an alphabet.
12
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Languages
L is a said to be a language over alphabet ∑, only if L ⊆ ∑*
🡺 this is because ∑* is the set of all strings (of all possible length including 0) over the given alphabet ∑
Examples:
L = {ε, 01, 10, 0011, 1100, 0101, 1010, 1001,…}
Definition: Ø denotes the Empty language
13
NO
Canonical ordering of strings in the language
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
The Membership Problem
Given a string w ∈∑*and a language L over ∑, decide whether or not w ∈L.
Example:
Let w = 100011
Q) Is w ∈ the language of strings with equal number of 0s and 1s?
14
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Finite Automata
15
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Finite Automata : Examples
16
Start state
Final state
Transition
Intermediate �state
action
state
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Structural expressions
17
Start with a letter
A string of other �letters (possibly�empty)
Other space delimited words�(part of city name)
Should end w/ 2-letter state code
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Formal Proofs
18
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Deductive Proofs
From the given statement(s) to a conclusion statement (what we want to prove)
Example for parsing a statement:
(there are other ways of writing this).
19
given
conclusion
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Example: Deductive proof
Let Claim 1: If y≥4, then 2y≥y2.
Let x be any number which is obtained by adding the squares of 4 positive integers.
Claim 2:
Given x and assuming that Claim 1 is true, prove that 2x≥x2
20
“implies” or “follows”
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
On Theorems, Lemmas and Corollaries
We typically refer to:
21
An example:
Theorem: The height of an n-node binary tree is at least floor(lg n)
Lemma: Level i of a perfect binary tree has 2i nodes.
Corollary: A perfect binary tree of height h has 2h+1-1 nodes.
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Quantifiers
“For all” or “For every”
“There exists”
Implication is denoted by =>
22
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Proving techniques
23
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Proving techniques…
24
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Different ways of saying the same thing
25
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
“If-and-Only-If” statements
26
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
Summary
27
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
/skit.org.in