Unit 1 - Finite Automata
Unit 1 - Finite Automata
• Computational Theory
– what can or can’t be solved by the automata
• It is denoted by ε
• The length of empty string is | w | = 0
• Σ + = Σ* - ε
• Σ+ = Σ1 U Σ 2 … … … .
• Σ+ = {0,1} U {00,01,10,11} U … … . .
= {0,1,00,01,10,11,….……..}
Kiruthika S.S., AP/CSE/SRMIST, RAMAPURAM 17
Language
• A language is a finite set of non-empty
strings, chosen from some Σ*
Or
• A language(L) is a subset of Σ* .
• A language which can be formed over ‘ Σ ‘
can be Finite or Infinite.
Kiruthika S.S., 2
AP/CSE/SRMIST, 2
Inductive Proof
It is a special form of proof that deals about the objects in
recursion.
Induction Principle:
If we prove S(i) and we prove that for all n>=I,
S(n)=>S(n+1), then we may conclude that s(n) for all n>=1.
It has two parts.
1.Basis part.
2.Inductive part.
Basis step: We have to show S(i) for a particular integer value
“i”, here “i “ may be zero or one.
Inductive step: We assume n>=i, where “i “ is the basis integer
and we have to show that if S(n) then S(n+1) i.e., S(n) =>S(n+1).
Kiruthika S.S., 2
AP/CSE/SRMIST, 5
Finite Automata
x1 x2 x3 x4 x5 …… .... xn …. no right-end
– δ : Transition function Q xΣ Q
– q0 : Initial State
– F : Final State
Kiruthika S.S., AP/CSE/SRMIST, RAMAPURAM 37
DFA - Example
Transition Diagram:
– δ : Transition function Q xΣ 2Q
– q0 : Initial State
– F : Final State
Kiruthika S.S., AP/CSE/SRMIST, RAMAPURAM 40
NFA - Example
Transition Diagram:
Recursive Language
Regular Language
• Let L be a language
• If and only if all the strings in L is accepted
by FA, then L is said to be a regular
language.
• L(A) = { w | δ’(q0,w) F }
Construction of NFA- ε
6. Draw a NFA with epsilon which accept the string “ab”.
δ (C,0)=δ({q0,q2},0) δ (D,1)=δ({q0,q1,q2},1)
δ (C,1)=δ({q0,q2},1)
=δ(q0,1) U δ(q2,1)
=[q0,q1] -----------(B)
1 0
Transition Diagram: [q0] [q0,q1] [q0,q2]
1 1
0
1
[q0,q1,q2]
0
Solution:
ε-closure {q0} = {q0, q1, q2}
ε-closure {q1} = {q1}
ε-closure {q2} = {q2}
ε-closure {q3} = {q3}
ε-closure {q4} = {q4}
a ε b
q0 q1 q2
Transition Diagram :
a
a b b
q0 q1 q2
bb
cc
dd
ee
ff
aa bb cc dd ee
0 0
[a,b] 1 [c,d,e]
f
0,1
2. Write the regular expression for the language accepting all the
string containing any number of a's and b's.
RE = (a + b)*
a.b
a+b a*
2. (0+1)*
Step-01:
There exist multiple final states.
So, we convert them into a single final state.
The resulting DFA is-
Step-03:
Now, let us eliminate state q3.
There is a path going from state q 2 to state qf via state q3.
So, after eliminating state q3 , we put a direct path from state
q2 to state qf having cost c.∈ = c.
83
Kiruthika S.S., AP/CSE/SRMIST, RAMAPURAM
Step-04:
Now, let us eliminate state q5.
There is a path going from state q 2 to state qf via state q5.
So, after eliminating state q5 , we put a direct path from state
q2 to state qf having cost d.∈ = d.
Final RE = a.(b+c+d)
Kiruthika S.S., 8
AP/CSE/SRMIST, 8
1. Prove that the language L={0n1n} is not regular.
Solution:
1. Assume the language is in RL.
2. Take z= 0n1n
3. |z|≥n, n+n ≥ n, 2n ≥ n
4. z= 0n1n
xzy= 0n1n
xy = 0n , z=1n
i) |xy|≤n,
|0n| ≤n
n≤n
ii. |y|≥ 1, [xy= 0n so x= 0m y= 0n-m, n>m]
| 0n-m | ≥ 1
n-m ≥ 1
Put k=1
xy1z = 0n (0n-m)1-1 1n
= 0n 1n is in L.
Put k=2
xy2z = 0n (0n-m)2-1 1n
= 02n-m 1n is not in L.
Fork=0 and 2, the derived strinngs are not in L.
So, the given language is not a regular language.