4. Reference Books:
K.L.P. Mishra, N.
Chandrasekaran,
Theory of Computer Science
(Automata, Languages &
Computation), Second Edition,
Prentice Hall of India, 1999
6. Reference Books:
John.E. Hopcroft, R. Motwani, and J.D.
Ullman, Introduction to Automata
Theory, Language and Computation,
Second Edition, Pearson Education
Asia, 2001.
9. AUTOMATA
Automata is Greek letters .Automata is a word
formulated from automation, which means machine
designing or replacing human beings with machines.
Every machine design requires some hardware part
and some software part.
A machine could be a finite state machine ,a Turing
Machine, a pushdown automata, or any other
restricted version of a Turing machine.
10. Input File
Sequence of symbols
Internal State
of Control Unit
Next-State Transition Function
May have Temporary Storage
Input File
Storage
Control Unit
Output
Automata
12. Sets
Sets are collections in which order of elements and duplication of
elements do not matter.
{1,a,1,1} = {a,a,a,1} = {a,1}
Size
Size of set mean number of elements in set e.g. |{a,b,c}| = 3
Special Sets
Empty Set
Universal Set U
13. Set Relations
Subset {a,c} {a,b,c}
Proper Subset {a,c} {a,b,c}
is-element-of b {a,b,c}
Set Operations
Union X Y
Intersection X Y
Difference X – Y
Complement X (always with respect to Universe)
Disjoint S1 S2 =
• Powerset 2x
• Is it possible for |S| = |2S|?
A x B = {(a,b): for all a A and b B}
14. DeMorgan’s Laws
S1 S2 = S1 S2
S1 S2 = S1 S2
Functions : S1 S2
S1 = Domain
S2 = Range
S1 may be same as S2
Equivalence Relations
Reflexive
Symmetric
Transitive
a, b S, we write a b if a is equivalent to b
15. What is a graph?
It's an abstract notion, used to represent the idea of some
kind of connection between pairs of objects.
A graph consists of:
A collection of "vertices", draw as small circles.
A collection of "edges", each connecting some two vertices.
Mathematical Definition
G = (V, E)
V = {v1,v2,…,vn} = Vertices
E = {e1, e2, …, em} = Edges
16. Graph Terminology
Walk = Sequence of edges
Path = Walk with no repeated edges
Simple Path = No vertices repeated
Cycle = Path from vi back to vi
Simple Cycle = Cycle with no vertices repeated
17. Character or Alphabet: An alphabet S is a set of symbols (characters, letters).
or
A finite set of symbols/ An abstract set of distinct symbols over which a
language is defined
String :A string (or word) over S is a sequence of symbols. The empty string is
the string containing no symbols at all, and is denoted by ε.
Length/Size of String: The length of a string is the number of symbols that it
contains (repetitions allowed). Absolute values are used to denote length.
The length of a string w is denoted |w|.
For example |00100| = 5
|aab| = 3
| epsilon | = 0
18. Concatenation : The concatenation of two strings is the string
resulting from putting them together from left to right.
If u=one and v=two then u · v=onetwo and
v · u=twoone.
Dot is usually omitted; just write uv for u · v.
Laws:
u · (v · w) = (u · v) · w
u · ε = u
ε · u = u
|u · v| = |u| + |v|
19. Regular Expression/Relational Expression
• Let Σ be an alphabet. The regular expressions(regex) are
defined inductively as follows:
– ø is a regular expression denoting {},
– ε is a regular expression denoting {},
– for each a Є Σ¸ a is a regular expression denoting
{a},
– Assume r and s are regular expressions denoting
sets R and S, then
. rs denotes RS,
. r + s denoted R υ S,
. r* denotes R*
21. Proof of Kleene Star
Let L0 and Li =L.L i-1 where i>=1 then Kleene closure of
L
is L*.L* is the set such that L* =Ui=0 Li i=0
L0={ε}
Solution
Suppose L={01,10}
L* = L0 U L1 U L2 U ………Ln
Its given that L0={ε}
Take i=1
L1 =L L 1-1
22. L1 =L L0
L1={01,10}.{ε}
L1={01 ε,10 ε}
L1={01,10}
Now Take i=2
L2 =L.L 2-1
L2 =L.L1
L2={01,10}. {01,10}
L2={0101,0110,1001,1010}
Now L*=L0 U L1 U L2 ….U Ln
L*={ε} U {01,10} U {0101,0110,1001,1010}…….
In a Kleene Star form it may be written as L*={01,10}*
23. Regular Language/Rational Language, Recognizable
Language.
A regular, rational, or recognizable language is one
that fulfils
one of the following equivalent criteria:
L is defined by a regular expression.
There are a finite number of L-cones.
L is recognized by a finite state automaton or FSA.
24. Language Expression Meaning Transition
Graph/Automata
L={0,1} r.e=(0+1)
r.e=(0/1)
r.e=(0 1)
choosing
from r1 or r2
L={0,1} r.e=(0.1)
r.e=(01)
r.e=(o∩1)
concatenati
on of r1 and
r2
L={0} r*=(0) zero or
more times
(Kleene
closure)
L={0} r+ =(0) one or more
times
0
1
0 1
0
0
0 0
27. What is the difference between the
two?
Is there a single DFA for a
corresponding NFA?
Why do we want to do this anyway?
28. Deterministic Finite Automata
For every state and every alphabet symbol there is exactly one
move that the machine can make
Mathematical Definition
A Deterministic Finite Automata is a 5-tuple (Q, Σ, δ, qo, F)
where
Q→Total numbers of State(s)
Σ→Input(s)/Alphabets(s)
δ→Transition Function QXΣ
q0→Initial State(s)
F→Final State(s)
29. Finite Automata State Graphs
An Input
A state
The start state
An accepting state
A transition a
a,b,…0,1,2…
30. Example r.e =a.b
Q→Total numbers of State(s) = {q0,q1,q2}
Σ→Input(s)/Alphabets(s)={a,b}
q0→Initial State(s)={q0}
F→Final State(s)={q2}
δ→Transition Function QXΣ
QXΣ Input a Input b
q0 q1 є
q1 є q2
q2 є є
q0
q1 q2
a b
q2
Acceptance State
/Final State
Initial
State
31. Nondeterministic Finite Automata
At each state, for each symbol, the machine can move into
0 or more states.
Mathematical Definition
A Non-Deterministic Finite Automata is a 5-tuple (Q,Σ,δ, qo,
F)
where
Q→Total numbers of State(s)
Σ→Input(s)/Alphabets(s)
δ→Transition Function 2 pow Q
q0→Initial State(s)
F→Final State(s)
33. Non-Deterministic Finite Automata
Example L={a}
a
a
a
1q 2q
3q
0q No transition:
the automaton hangs
Acceptance state/Final State
Two choices
QX Σ Input a
q0 q1 U q3
q1 q2
q2 є
q3 є
34. Nondeterministic Finite Automata
Non-determinism
When machine is in a given state and reads a
symbol, the machine will have a choice of
where to move to next.
There may be states where, after reading a
given symbol, the machine has nowhere to go.
Applying the transition function will give, not 1
state, but 0 or more states.
39. REGULAR EXPRESSION
Theorem If L is accepted by a DFA, then L is
denoted by a regular expression.
The language of FA (regular language) is the set of
strings that label paths that go from the start state
to some accepting state.
The languages accepted by DFA, NFA,
e-NFA, Regular Expressions are called
regular languages
40. REGULAR EXPRESSION
The regular expressions over are the
smallest set of expressions including
where
where A,B are rexp over
" " "
where A is a rexp over
‘c’
A+B
AB
A*
e
c
41. Regular Expression Notation
a: an ordinary letter
ε: the empty string
r1 | r2: choosing from r1 or r2
r1r2 : concatenation of r1 and r2
r*: zero or more times (Kleene closure)
r+: one or more times
42. NFA to DFA Conversion
What is the difference between the two?
Is there a single DFA for a corresponding
NFA?
Why do we want to do this anyway?
43. Nondeterministic Finite Automata
Non-determinism
When machine is in a given state and reads a
symbol, the machine will have a choice of
where to move to next.
There may be states where, after reading a
given symbol, the machine has nowhere to go.
Applying the transition function will give, not 1
state, but 0 or more states.
44. Nondeterministic Finite Automata
At each state, for each symbol, the machine can
move into 0 or more states.
A Non-Deterministic Finite Automata is a
5-tuple (Q, S, d, qo, F) where
Input alphabet, i.e.
Transition function 2 pow Q
Initial state i.e.
Final states i.e.
:Q
:
:
:0q
:F
Set of states, i.e. { q0, q1, q2, q3, q4}
{1,0}
{q0}
{q4}
45. Nondeterministic Finite Automata
Two non-deterministic elements:
Lambda transitions or epsilon transitions
2 out arcs with same symbol
46. For every state and every alphabet symbol
there is exactly one move that the machine can
make
A Deterministic Finite Automata is a
5-tuple (Q, S, d, qo, F) where
Deterministic Finite Automata
:Q
:
:
:0q
:F
Input alphabet
Transition function Q x I
Initial state
Final states
Set of states
51. For re=r1*
e
e
e r1 eS A B Fstart
r1 r1
S BAF Astart
r1
NFA (e-move)
DFA
States/
input
r1
S BFBA=BAF
A BAF
B
F
BAF BAF
Transaction table:
r1*BAFS
r1
start
r1
NFA ->DFA (EXAMPLE-1)
52. NFA ->DFA (EXAMPLE-2)
For re=r1.r2
NFA (e-move)
For r1 For r2
For r1.r2
A B
r1
start C D
r2
start
A B C D
er1 r2
start
53. NFA ->DFA (EXAMPLE-2 cont….)
State
s/
input
r1 r2
A BC
B
C D
D
BC D
DFA
Transaction table:
A BC Dr2r1
start
CA BC D
r2r1 r2
start
r1.r2
54. NFA ->DFA (EXAMPLE-3)
For re=r1+r2
For r1 For r2
C D
r2
startA B
r1
start
e e
A B
r1
C D
r2
start S F
ee
For r1+r2
55. NFA ->DFA (EXAMPLE-3 cont….)
FD
State
s/inpu
t
r1 r2
S BF DF
A BF
B
C DF
D
F
BF
DF
Transaction table:
DFA
BDFstart
r1/r2
S
r1+r2
r1r1
BF A
DF Cr2
start S
r2
BF
DF
start S
r1
r2
56. NFA ->DFA (EXAMPLE-1)
q0 q1 q2start
a b
a,b
q0 q0q1 q0q2start
a b
b
a
a
b
States
/
input
a b
q0 q1q0 q0
q1 q2
q2
q1q0 q1q0 q0q
2
q0q2 q1q2 q0
Transaction table:
NFA
Equivalent DFA
57. NFA ->DFA (EXAMPLE-2)
B A
C
start
0
0
1
10
B ABCstart
0
0
1
AC
1
A
B ABCstart
0
0
1
AC
1
NFA
Equivalent DFA
States
/
input
0 1
B BAC
A AC
C
ABC ABC AC
AC AC
Transaction table: